pgdesign v0.26.0 /internal/config
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

Go go
var CodegenModes map[string][]string

CodegenModes 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

Go go
type RelativePath string

RelativePath represents a path as declared in the TOML config file (relative to project root).

#AbsolutePath

Go go
type AbsolutePath string

AbsolutePath represents a fully resolved absolute filesystem path.

#PathKind

Go go
type PathKind interface

PathKind constrains the Config generic to either relative or absolute paths.

#RawConfig

Go go
type RawConfig = Config[RelativePath]

RawConfig is a Config with relative paths, as parsed directly from TOML.

#ResolvedConfig

Go go
type ResolvedConfig = Config[AbsolutePath]

ResolvedConfig is a Config with all paths resolved to absolute paths.

#DatabaseConfig

Go go
type DatabaseConfig struct

DatabaseConfig holds [database] section values.

#FormatConfig

Go go
type FormatConfig struct

FormatConfig holds [format] section values.

#ValidateConfig

Go go
type ValidateConfig struct

ValidateConfig holds [validate] section values.

#MigrateConfig

Go go
type MigrateConfig struct

MigrateConfig holds [migrate] section values.

#D2Config

Go go
type D2Config struct

D2Config holds the [output..d2] subsection: diagram presentation for the d2 and svg formats. It is a plain config struct with no dependency on the generate package; cmd/pgdesign maps it onto generate.D2Options (starting from generate.DefaultD2Options, so an absent subsection yields the intended defaults). Opt-out enrichment layers use *bool so "unset" (default-on) is distinguishable from an explicit "= false".

#RenamesConfig

Go go
type RenamesConfig struct

RenamesConfig 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

Go go
type TableRename struct

TableRename is one declared table rename (old -> new).

#ColumnRename

Go go
type ColumnRename struct

ColumnRename is one declared column rename within a table (old -> new).

#ImportDecl

Go go
type ImportDecl struct

ImportDecl is one [imports.] declaration: a pinned dependency on another pgdesign project's schema (roadmap 7.1). The alias is the map key. Git is the fetch URL, Ref is the git ref pinned at lock time, and Schema is the target PostgreSQL namespace an 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

Go go
type ExtensionConfig struct

ExtensionConfig holds [[extensions]] array-of-tables entries.

#Load

Go go
func Load(path string) (*RawConfig, error)

Load reads and parses a pgdesign.toml file at the given path.

#LoadBytes

Go go
func LoadBytes(data []byte) (*RawConfig, error)

LoadBytes parses config from in-memory bytes.

#LoadOrDefault

Go go
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

Go go
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

Go go
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

Go go
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.

Search