Documentation
¶
Overview ¶
Package database holds database connection configuration and lifecycle.
Index ¶
Constants ¶
View Source
const ( DriverPostgres = "postgres" DriverMySQL = "mysql" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Driver string `mapstructure:"driver" validate:"required,oneof=postgres"`
Test bool `mapstructure:"-"`
}
Config selects the database driver. Driver-specific settings live outside this struct so service config can keep database selection small and place driver config in sibling top-level blocks.
type Database ¶
type Database struct {
// contains filtered or unexported fields
}
type PostgresConfig ¶
type PostgresConfig struct {
Host string `mapstructure:"host"`
Port int `mapstructure:"port"`
Name string `mapstructure:"name"`
Username string `mapstructure:"username"`
Password string `mapstructure:"password"`
Timeout int `mapstructure:"timeout"`
SSLMode string `mapstructure:"ssl_mode"`
MigrationPath string `mapstructure:"migration_path"`
}
PostgresConfig holds PostgreSQL connection settings. Services embed it in their config structs; the mapstructure tags live here so every service shares the same config schema.
func (PostgresConfig) Validate ¶
func (c PostgresConfig) Validate() error
Click to show internal directories.
Click to hide internal directories.