sqlgen

package
v1.16.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package sqlgen turns an app's queries/*.sql files into a Go package of typed functions (ADR 0028). Types come from the schema the app's migrations build, in a scratch SQLite database.

Index

Constants

View Source
const (
	Dir  = "queries"
	File = "queries.gen.go"
)

Dir is where an app keeps its queries, and File the Go file generated next to them.

Variables

This section is empty.

Functions

func Generate

func Generate(ctx context.Context, root string) ([]byte, error)

Generate types the queries in root/queries against the schema of the app's migrations and returns the Go file for them, or nil when the app has no queries.

Types

This section is empty.

Directories

Path Synopsis
sqlgentest
migrations
Package migrations is the schema the sqlgen tests type queries against.
Package migrations is the schema the sqlgen tests type queries against.
queries
Package queries runs the app's SQL queries, typed from its schema (see docs/sql.md).
Package queries runs the app's SQL queries, typed from its schema (see docs/sql.md).

Jump to

Keyboard shortcuts

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