config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 25, 2026 License: MIT Imports: 5 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 {
	// Multi-host config (preferred)
	Hosts map[string]HostConfig `yaml:"hosts"`

	// Single-host config (backward compat — migrated to Hosts["default"] on load)
	Connection ConnectionConfig          `yaml:"connection"`
	Databases  map[string]DatabaseConfig `yaml:"databases"`

	Defaults DefaultsConfig `yaml:"defaults"`
	DryRun   DryRunConfig   `yaml:"dry_run"`
}

func Load

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

func (*Config) HostNames

func (c *Config) HostNames() []string

type ConnectionConfig

type ConnectionConfig struct {
	Host            string `yaml:"host"`
	Port            int    `yaml:"port"`
	User            string `yaml:"user"`
	Password        string `yaml:"password"`
	SSLMode         string `yaml:"sslmode"`
	DefaultDatabase string `yaml:"default_database"`
}

func (*ConnectionConfig) DSN

func (c *ConnectionConfig) DSN(database string) string

DSN builds a libpq-style key=value connection string for the given database. If database is empty, the connection config's DefaultDatabase is used.

type DatabaseConfig

type DatabaseConfig struct {
	Access string                 `yaml:"access"`
	Tables map[string]TableConfig `yaml:"tables"`
}

type DefaultsConfig

type DefaultsConfig struct {
	Access string `yaml:"access"`
}

type DryRunConfig

type DryRunConfig struct {
	TimeoutSeconds int `yaml:"timeout_seconds"`
}

type HostConfig

type HostConfig struct {
	Connection ConnectionConfig          `yaml:"connection"`
	Databases  map[string]DatabaseConfig `yaml:"databases"`
}

type TableConfig

type TableConfig struct {
	Access string `yaml:"access"`
}

Jump to

Keyboard shortcuts

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