Documentation
¶
Index ¶
- func ApplyPoolTuning(db *gorm.DB, config *Config) error
- func BuildDSN(config *Config) string
- func Close(db *gorm.DB, logger schemas.Logger)
- func Open(dsn string, config *Config, logger gormlogger.Interface) (*gorm.DB, error)
- func RunPasswordCommand(ctx context.Context, config *PasswordCommandConfig) (string, error)
- func Validate(config *Config, requireStaticPassword bool) error
- type Config
- type PasswordCommandConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyPoolTuning ¶
ApplyPoolTuning applies MaxIdleConns, MaxOpenConns, and ConnMaxLifetime.
func RunPasswordCommand ¶
func RunPasswordCommand(ctx context.Context, config *PasswordCommandConfig) (string, error)
RunPasswordCommand executes a configured password command and returns stdout.
Types ¶
type Config ¶
type Config struct {
Host *schemas.EnvVar `json:"host"`
Port *schemas.EnvVar `json:"port"`
User *schemas.EnvVar `json:"user"`
Password *schemas.EnvVar `json:"password"`
PasswordCommand *PasswordCommandConfig `json:"password_command,omitempty"`
DBName *schemas.EnvVar `json:"db_name"`
SSLMode *schemas.EnvVar `json:"ssl_mode"`
MaxIdleConns int `json:"max_idle_conns"`
MaxOpenConns int `json:"max_open_conns"`
ConnMaxLifetime string `json:"conn_max_lifetime,omitempty"`
}
Config is the shared Postgres connection configuration used by framework stores.
type PasswordCommandConfig ¶
type PasswordCommandConfig struct {
Command string `json:"command"`
Args []string `json:"args,omitempty"`
Timeout string `json:"timeout,omitempty"`
}
PasswordCommandConfig describes a command that prints a Postgres password to stdout.
Click to show internal directories.
Click to hide internal directories.