config

package
v1.35.0 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DBProvider

type DBProvider interface {
	GetDatabaseConfig() DatabaseConfig
}

type DatabaseConfig

type DatabaseConfig struct {
	Driver DatabaseDriver `mapstructure:"driver"`
	Name   string         `mapstructure:"name"`
	Host   string         `mapstructure:"host"`
	Port   int            `mapstructure:"port"`
	// Username / Password identify the service role used for ordinary business
	// logic (DML). This role is deliberately unprivileged: it cannot run
	// migrations.
	Username string `mapstructure:"username"`
	Password string `mapstructure:"password"`
	// MigrationUsername / MigrationPassword identify the migration role, which
	// holds the elevated privileges (DDL, schema ownership) that migrations need
	// and DML does not. Only the cmd/migrate entry-point uses these.
	MigrationUsername string `mapstructure:"migration_username"`
	MigrationPassword string `mapstructure:"migration_password"`
	SSLMode           string `mapstructure:"ssl_mode"`
	DataSource        string
}

func (*DatabaseConfig) BuildDataSource

func (d *DatabaseConfig) BuildDataSource()

BuildDataSource resolves DataSource for the service role (Username/Password), used by the running services for business logic.

func (*DatabaseConfig) BuildMigrationDataSource added in v1.35.0

func (d *DatabaseConfig) BuildMigrationDataSource()

BuildMigrationDataSource resolves DataSource for the migration role (MigrationUsername/MigrationPassword), used by cmd/migrate.

func (*DatabaseConfig) Validate

func (d *DatabaseConfig) Validate() error

Validate validates the config for the running services, which connect as the service role.

func (*DatabaseConfig) ValidateMigration added in v1.35.0

func (d *DatabaseConfig) ValidateMigration() error

ValidateMigration validates the config for the cmd/migrate entry-point, which connects as the migration role. An unset migration user fails loudly here rather than connecting as an empty user.

type DatabaseDriver

type DatabaseDriver string
const (
	DatabaseDriverPostgres DatabaseDriver = "postgres"
	DatabaseDriverYugabyte DatabaseDriver = "yugabyte"
)

func (DatabaseDriver) IsValid

func (d DatabaseDriver) IsValid() bool

Jump to

Keyboard shortcuts

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