sqlc-gen-zig

command module
v0.0.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 1, 2025 License: MIT Imports: 2 Imported by: 0

README

sqlc-gen-zig

A Zig code generator for sqlc.

Usage

Head over to the releases for instructions on how to configure your sqlc.yaml. An example project can be found in the examples/ directory.

Configuration
# sqlc.yaml
version: "2"
plugins:
  - name: zig
    wasm:
      url: https://github.com/tinyzimmer/sqlc-gen-zig/releases/download/v0.0.6/sqlc-gen-zig.wasm
      sha256: e56c08768e411a7e8bee58ef8697cef73a37d917f84065248662bad89d1170e7
sql:
  - schema: schema.sql
    queries: queries.sql
    engine: postgresql
    codegen:
      - out: src/models
        plugin: zig
        options: {}

Below are the available options with their default values:

# The Zig backend to use (currently only "pg.zig" is supported)
backend: pg.zig
# Set to true to create structs with the singular table name
emit_exact_table_names: false
# Exclude the following table names from being parsed into their singular form
inflection_exclude_table_names: []
# The maximum number of query parameters before creating a struct to hold them
query_parameter_limit: 3
# Mark the raw query string constants as public
public_query_strings: false
# Set to true to not have the Querier store an internal allocator. Each query
# method will take an allocator as a parameter instead.
unmanaged_allocations: false
# Use callbacks as parameters to generated methods. This is useful for code that
# wants to execute queries with zero additional allocations.
# use_callbacks: false

Development

The code generator is written in Go and uses the sqlc-plugin-sdk. An end-to-end test can be run with make e2e.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL