config

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 31, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Version    string            `yaml:"version"`
	Engine     Engine            `yaml:"engine"`
	Schema     []Source          `yaml:"schema"`
	Queries    []Source          `yaml:"queries"`
	Migrations []MigrationSource `yaml:"migrations"`
	Plugins    []PluginConfig    `yaml:"plugins"`
	Options    GlobalOptions     `yaml:"options"`
}

Config is the root of a generation run, read from a YAML file.

func Load

func Load(path string) (*Config, error)

Load reads a YAML config file at path, validates it, applies defaults, and returns the populated Config.

func (*Config) Validate

func (cfg *Config) Validate() error

Validate applies defaults and checks required fields. It returns the first error encountered with enough context to locate it.

type Engine

type Engine string

Engine identifies the SQL dialect.

const EnginePostgreSQL Engine = "postgresql"

type GlobalOptions

type GlobalOptions struct {
	DefaultSchema string            `yaml:"defaultSchema"`
	SearchPath    []string          `yaml:"searchPath"`
	TypeOverrides map[string]string `yaml:"typeOverrides"`
	Strict        bool              `yaml:"strict"`
}

GlobalOptions are host-wide generation settings.

type MigrationSource

type MigrationSource struct {
	Dir  string `yaml:"dir"`
	Glob string `yaml:"glob"`
}

MigrationSource points at a directory (or glob) of up-migration SQL files. Migrations are the sole source of schema DDL.

type PluginConfig

type PluginConfig struct {
	Name    string            `yaml:"name"`
	Wasm    string            `yaml:"wasm"`
	Binary  string            `yaml:"binary"`
	Command string            `yaml:"command"`
	Args    []string          `yaml:"args"`
	SHA256  string            `yaml:"sha256"`
	Out     string            `yaml:"out"`
	Options map[string]any    `yaml:"options"`
	Env     map[string]string `yaml:"env"`
	Enabled *bool             `yaml:"enabled"` // nil means true
}

PluginConfig describes one code-generation plugin.

func (PluginConfig) IsEnabled

func (p PluginConfig) IsEnabled() bool

IsEnabled reports whether the plugin should run (default true when Enabled is nil).

type Source

type Source struct {
	File      string `yaml:"file"`
	Dir       string `yaml:"dir"`
	Inline    string `yaml:"inline"`
	Glob      string `yaml:"glob"`
	Recursive bool   `yaml:"recursive"`
}

Source describes a single SQL input for named queries: either a file, a directory, inline SQL text, or a glob pattern applied to the current directory.

Jump to

Keyboard shortcuts

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