sqld

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

Overview

Package sqld is the public API for the sqld engine: parse PostgreSQL sources into the semantic IR (a Catalog) and run code-generation plugins against it.

Typical use:

cfg, err := sqld.LoadConfig("sqld.yaml")
if err != nil { ... }
cat, err := sqld.Collect(cfg)   // schema + migrations -> IR
// or
err = sqld.Generate(cfg)        // Collect, then run the configured plugins

The IR and plugin contract messages are protobuf types under github.com/gopherex/sqld/pkg/proto/sqld/v1/{ir,plugin}. The config is a plain Go struct under github.com/gopherex/sqld/pkg/config.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Collect

func Collect(cfg *Config) (*irv1.Catalog, error)

Collect parses the configured SQL and migrations into the IR Catalog.

func CollectFile

func CollectFile(path string) (*irv1.Catalog, error)

CollectFile loads a config file and collects the IR Catalog from it.

func Generate

func Generate(cfg *Config) error

Generate runs Collect and then drives the configured plugins, writing their output files to disk.

func GenerateFile

func GenerateFile(path string) error

GenerateFile loads a config file and runs generation from it.

Types

type Config

type Config = config.Config

Config re-exports the config type for callers who import only pkg/sqld.

func LoadConfig

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

LoadConfig reads and parses a YAML config file into a Config struct.

type Diagnostic

type Diagnostic struct {
	Severity string // "info" | "warning" | "error"
	Message  string
}

Diagnostic is a non-fatal issue surfaced while building the IR (e.g. an unresolved column type or an unhandled statement).

type Result

type Result struct {
	Catalog     *irv1.Catalog
	Queries     []*pluginv1.Query
	Migrations  []*pluginv1.Migration
	Diagnostics []Diagnostic
}

Result is the full output of a collection pass.

func CollectAll

func CollectAll(cfg *Config) (*Result, error)

CollectAll runs the full pipeline and returns the Catalog together with the inferred queries, parsed migrations, and any diagnostics.

Jump to

Keyboard shortcuts

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