sqlcconfig

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package sqlcconfig parses sqlc configuration files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ColumnRef

type ColumnRef struct {
	Schema string
	Table  string
	Column string
}

ColumnRef is used to look up column metadata.

type ColumnTarget

type ColumnTarget struct {
	Schema string
	Table  string
	Name   string
	// contains filtered or unexported fields
}

ColumnTarget identifies a table column referenced by a sqlc override.

func (ColumnTarget) IsZero

func (c ColumnTarget) IsZero() bool

IsZero reports whether the column target is unset.

func (*ColumnTarget) UnmarshalYAML

func (c *ColumnTarget) UnmarshalYAML(value *yaml.Node) error

UnmarshalYAML supports both string and mapping forms for column targets.

type Config

type Config struct {
	Version   string     `yaml:"version"`
	SQL       []SQLBlock `yaml:"sql"`
	Overrides []Override `yaml:"overrides"`
	// contains filtered or unexported fields
}

Config represents the subset of sqlc configuration required for override migration.

func Load

func Load(path string) (Config, error)

Load reads and validates a sqlc configuration file.

func (Config) ColumnType

func (c Config) ColumnType(ref ColumnRef) (string, bool)

ColumnType returns the SQLite type for the referenced column if known.

func (Config) SchemaWarnings

func (c Config) SchemaWarnings() []string

SchemaWarnings returns a copy of schema parsing warnings encountered during load.

type GoType

type GoType struct {
	Import  string `yaml:"import"`
	Package string `yaml:"package"`
	Type    string `yaml:"type"`
	Pointer bool   `yaml:"pointer"`
	// contains filtered or unexported fields
}

GoType captures sqlc go_type override definitions.

func (GoType) Normalize

func (g GoType) Normalize() (GoTypeInfo, error)

Normalize returns the normalized Go type information for this override.

func (*GoType) UnmarshalYAML

func (g *GoType) UnmarshalYAML(value *yaml.Node) error

UnmarshalYAML captures string or mapping go_type definitions.

type GoTypeInfo

type GoTypeInfo struct {
	ImportPath  string
	PackageName string
	TypeName    string
	Pointer     bool
}

GoTypeInfo represents a normalized Go type description.

type Override

type Override struct {
	DBType string       `yaml:"db_type"`
	Column ColumnTarget `yaml:"column"`
	GoType GoType       `yaml:"go_type"`
}

Override mirrors sqlc override entries for db_type or column overrides.

type SQLBlock

type SQLBlock struct {
	Engine   string   `yaml:"engine"`
	Schema   []string `yaml:"schema"`
	Queries  []string `yaml:"queries"`
	Database struct {
		Schema string `yaml:"schema"`
	} `yaml:"database"`
}

SQLBlock captures the sqlc sql entry containing schema paths.

Jump to

Keyboard shortcuts

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