sqlc-gen-zz

command module
v0.0.0-...-c069132 Latest Latest
Warning

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

Go to latest
Published: May 4, 2025 License: MIT Imports: 9 Imported by: 0

README

sqlc-gen-zz

sqlc plugin for zombiezen.com/go/sqlite

Quick Start

Install sqlc and plugin, then sqlc generate in a project with a sqlc.yaml with the process plugin config:

brew install sqlc
go install github.com/nzoschke/sqlc-gen-zz@latest
sqlc generate
version: "2"

plugins:
  - name: zz
    process:
      cmd: sqlc-gen-zz

sql:
  - codegen:
      - out: c
        plugin: zz
    engine: "sqlite"
    queries: "query.sql"
    schema: "schema.sql"

Time Convention

If a text field ends with _at it is converted from/to a YYYY-MM-DD HH:MM:SS string and a time.Time in support of:

created_at TEXT DEFAULT CURRENT_TIMESTAMP NOT NULL

JSON Overrides

By default this will use []byte for JSON column type.

But like sqlc JSON overrides, you can specify a struct and this will marshal/unmarshal the struct automatically.

Note that overrides are passed in through the plugin options.

Development

rm -rf pkg/sql/c
go install ./... 
go generate ./...
go test ./...

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
pkg
db
gen
sql

Jump to

Keyboard shortcuts

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