Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewDBConnection ¶
func NewDBConnection(conf YamlConfig) *gorm.DB
Types ¶
type Application ¶
type BaseConfig ¶
type BaseConfig struct {
DBConnection *gorm.DB
YamlConfig YamlConfig
}
func NewBaseConfig ¶
func NewBaseConfig() BaseConfig
func (*BaseConfig) ConnectDB ¶
func (bc *BaseConfig) ConnectDB() error
ConnectDB: connect to MySQL only when needed (safe to call multiple times)
type IntOrString ¶
type IntOrString int
func (*IntOrString) UnmarshalYAML ¶
func (ios *IntOrString) UnmarshalYAML(value *yaml.Node) error
UnmarshalYAML: receive number or string and convert to number. Non-numeric strings return 0 with warning log.
type Redis ¶
type Redis struct {
Host string `yaml:"host"`
Port int `yaml:"port"`
User string `yaml:"user"`
Pass string `yaml:"pass"`
DB IntOrString `yaml:"db"`
}
type YamlConfig ¶
type YamlConfig struct {
Application Application `yaml:"Application"`
MySQL MySQL `yaml:"MySQL"`
Redis Redis `yaml:"Redis"`
}
Click to show internal directories.
Click to hide internal directories.