Documentation
¶
Index ¶
Constants ¶
View Source
const ( // DefaultLocation is the default location for MySQL connections. DefaultLocation = "America/New_York" // DefaultMySQLPort is the default port for MySQL connections. DefaultMySQLPort = 3306 )
Variables ¶
View Source
var ( // MaxOpenConns will be used to set a MySQL // drivers MaxOpenConns value. MaxOpenConns = 1 // MaxIdleConns will be used to set a MySQL // drivers MaxIdleConns value. MaxIdleConns = 1 )
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Pw string `envconfig:"MYSQL_PW"`
User string `envconfig:"MYSQL_USER"`
Port int `envconfig:"MYSQL_PORT"`
DBName string `envconfig:"MYSQL_DB_NAME"`
Location string `envconfig:"MYSQL_LOCATION"`
Host string `envconfig:"MYSQL_HOST_NAME"`
ReadTimeout string `envconfig:"MYSQL_READ_TIMEOUT"`
WriteTimeout string `envconfig:"MYSQL_WRITE_TIMEOUT"`
AddtlDSNOptions string `envconfig:"MYSQL_ADDTL_DSN_OPTIONS"`
}
Config holds everything you need to connect and interact with a MySQL DB.
func LoadConfigFromEnv ¶
func LoadConfigFromEnv() *Config
LoadConfigFromEnv will attempt to load a MySQL object from environment variables. If not populated, nil is returned.
Click to show internal directories.
Click to hide internal directories.