Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
Host string `mapstructure:"host"`
Port int `mapstructure:"port"`
Username string `mapstructure:"username"`
Password string `mapstructure:"password"`
Database string `mapstructure:"database"`
Timeout string `mapstructure:"timeout"`
// Connection settings
// TODO Pool field name must be modified in the next major change.
Pool int `mapstructure:"pool"`
MaxOpenConnections int `mapstructure:"max_open_connections"`
ConnectionMaxIdleTime time.Duration `mapstructure:"connection_max_idle_time"`
ConnectionMaxLifetime time.Duration `mapstructure:"connection_max_lifetime"`
}
Config is the database connection configuration.
type ConnectionDetails ¶
type ConnectionDetails struct {
Dialect string
Username string
Password string
Host string
Port int
Database string
Encoding string
Timeout string
Pool int
}
ConnectionDetails represents database connection details.
func NewConnectionDetails ¶
func NewConnectionDetails(config *Config) ConnectionDetails
NewConnectionDetails creates a new ConnectionDetails struct from a DB configuration.
func (ConnectionDetails) String ¶
func (cd ConnectionDetails) String() string
String builds a connection string from a database Config.
func (ConnectionDetails) StringWithoutDB ¶
func (cd ConnectionDetails) StringWithoutDB() string
StringWithoutDB builds a connection string from a database Config without the database.
Click to show internal directories.
Click to hide internal directories.