On this page
Package config loads and validates pgdesign.toml project configuration files including output targets, suppression rules, and extension declarations.
#internal/config
#internal/config
Package config loads and validates pgdesign.toml project configuration files including output targets, suppression rules, and extension declarations.
#CodegenModes
var CodegenModes map[string][]stringCodegenModes maps codegen mode names to the languages each mode supports. Set by the main package to enable mode and lang-mode pair validation. When nil, only hardcoded mode names are checked.
#RelativePath
type RelativePath stringRelativePath represents a path as declared in the TOML config file (relative to project root).
#AbsolutePath
type AbsolutePath stringAbsolutePath represents a fully resolved absolute filesystem path.
#PathKind
type PathKind interfacePathKind constrains the Config generic to either relative or absolute paths.
#RawConfig
type RawConfig = Config[RelativePath]RawConfig is a Config with relative paths, as parsed directly from TOML.
#ResolvedConfig
type ResolvedConfig = Config[AbsolutePath]ResolvedConfig is a Config with all paths resolved to absolute paths.
#DatabaseConfig
type DatabaseConfig structDatabaseConfig holds [database] section values.
#FormatConfig
type FormatConfig structFormatConfig holds [format] section values.
#ValidateConfig
type ValidateConfig structValidateConfig holds [validate] section values.
#MigrateConfig
type MigrateConfig structMigrateConfig holds [migrate] section values.
#D2Config
type D2Config structD2Config holds the [output.
#RenamesConfig
type RenamesConfig structRenamesConfig holds the [renames] section: declared table and column renames consumed at migration diff time (roadmap 5.9 rename gate). It is a pure, committed, CI-safe directive — never part of any schema's identity. TOML shape (inline-table arrays):
[renames] tables = [ { from = "old_table", to = "new_table" } ] columns = [ { table = "users", from = "email_addr", to = "email" } ]
#TableRename
type TableRename structTableRename is one declared table rename (old -> new).
#ColumnRename
type ColumnRename structColumnRename is one declared column rename within a table (old -> new).
#ImportDecl
type ImportDecl structImportDecl is one [imports.alias:table reference resolves into.
TOML shape (both syntaxes accepted):
[imports] framework = { git = "https://example/repo.git", ref = "v1.2.3", schema = "app" }
[imports.framework] git = "https://example/repo.git" ref = "v1.2.3" schema = "app"
#ExtensionConfig
type ExtensionConfig structExtensionConfig holds [[extensions]] array-of-tables entries.
#Load
func Load(path string) (*RawConfig, error)Load reads and parses a pgdesign.toml file at the given path.
#LoadBytes
func LoadBytes(data []byte) (*RawConfig, error)LoadBytes parses config from in-memory bytes.
#LoadOrDefault
func LoadOrDefault(dir string) (*RawConfig, error)LoadOrDefault attempts to load pgdesign.toml from dir. If the file does not exist, it returns a zero-valued Config (all defaults). Other errors are returned.
#LoadAndResolve
func LoadAndResolve(path string) (*ResolvedConfig, error)LoadAndResolve loads pgdesign.toml at the given path and resolves all relative paths to absolute paths using the directory containing the config file as the project root.
#Resolve
func Resolve(raw *RawConfig, projectRoot string) (*ResolvedConfig, error)Resolve converts a RawConfig (relative paths) into a ResolvedConfig (absolute paths) by resolving each path relative to projectRoot.
#FindConfig
func FindConfig(dir string) (string, bool)FindConfig looks for pgdesign.toml by walking from the given directory toward the filesystem root. Returns the path and true if found, or empty string and false if not found in any ancestor.