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
Click to show internal directories.
Click to hide internal directories.