Documentation
¶
Overview ¶
Package schemacheck reads the canonical SQL of both roles and the bindings generated from it so tests can compare them against a real database. It exposes those inputs without interpreting them: deciding what has to agree is left to the tests.
Index ¶
- func AppliedVersion(ctx context.Context, db *sql.DB) (int64, error)
- func CanonicalQueryNames(dir string) ([]string, error)
- func Directives(sequence fs.FS, name string) error
- func GeneratedQueries(dir string) (map[string]string, error)
- func GeneratedStructs(path string) (map[string][]string, error)
- func OpenFresh(ctx context.Context, dir string, sequence fs.FS) (*sql.DB, error)
- func RepoRoot() (string, error)
- func Signature(names []string) string
- func TableColumns(ctx context.Context, db *sql.DB) (map[string][]string, error)
- type GeneratorConfig
- type Migration
- type Role
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppliedVersion ¶
AppliedVersion reports the highest migration goose recorded as applied.
func CanonicalQueryNames ¶
CanonicalQueryNames returns the names declared in the SQL below dir.
func Directives ¶
Directives reports whether a migration carries both goose annotations. A file without them applies as a single statement block or not at all.
func GeneratedQueries ¶
GeneratedQueries returns the SQL embedded in the generated bindings below dir, keyed by the query name the generator recorded with it.
func GeneratedStructs ¶
GeneratedStructs returns the field names of every generated model struct.
func OpenFresh ¶
OpenFresh creates a new SQLite database below dir and applies the embedded sequence to it. The caller closes the returned handle.
Types ¶
type GeneratorConfig ¶
GeneratorConfig holds the directories recorded in sqlc.yml.
func ReadGeneratorConfig ¶
func ReadGeneratorConfig(path string) (GeneratorConfig, error)
ReadGeneratorConfig collects the directories the SQL generator reads and writes, so tests can confirm they address the sequences the roles embed.