Documentation
¶
Index ¶
- Constants
- func InjectConf(conf interface{})
- func Load()
- func Query(model ModelInterface) *gorm.DB
- type ConnectorInterface
- type DatabaseConf
- type DatabaseConfDriverInterface
- type DatabaseConf_MySql
- type DatabaseConf_MySql_HealthCheck
- type DatabaseConf_MySql_Pool
- type DbContainer
- type ModelInterface
- type MysqlConnector
Constants ¶
View Source
const (
DB_DRIVER_MYSQL string = "mysql"
)
Variables ¶
This section is empty.
Functions ¶
func InjectConf ¶ added in v0.0.52
func InjectConf(conf interface{})
func Query ¶
func Query(model ModelInterface) *gorm.DB
Types ¶
type ConnectorInterface ¶
type ConnectorInterface interface {
Connect(DatabaseConfDriverInterface) *gorm.DB
}
type DatabaseConf ¶
type DatabaseConf struct {
MysqlConnections map[string]*DatabaseConf_MySql
}
func GetDatabaseConf ¶ added in v0.0.52
func GetDatabaseConf() *DatabaseConf
func (*DatabaseConf) ConfigName ¶
func (i *DatabaseConf) ConfigName() string
type DatabaseConfDriverInterface ¶
type DatabaseConfDriverInterface interface {
GetDriver() string
}
type DatabaseConf_MySql ¶
type DatabaseConf_MySql struct { Driver string `json:"driver"` Host string `json:"host"` Port int `json:"port"` Database string `json:"database"` Username string `json:"username"` Password string `json:"password"` Charset string `json:"charset"` Collation string `json:"collation"` Prefix string `json:"prefix"` Debug bool `json:"debug"` Pool *DatabaseConf_MySql_Pool `json:"pool"` HealthCheck *DatabaseConf_MySql_HealthCheck `json:"health_check"` }
func (*DatabaseConf_MySql) GetDriver ¶
func (i *DatabaseConf_MySql) GetDriver() string
type DatabaseConf_MySql_Pool ¶
type DatabaseConf_MySql_Pool struct { MaxIdleConnections int `json:"max_idle_connections"` //MinConnections int `json:"min_connections"` MaxConnections int `json:"max_connections"` ConnectTimeout int `json:"connect_timeout"` //WaitTimeout int `json:"wait_timeout"` //Heartbeat int `json:"heartbeat"` MaxIdleTime int `json:"max_idle_time"` }
type DbContainer ¶
func (*DbContainer) SetDebug ¶
func (c *DbContainer) SetDebug(name string, isDebug bool)
type ModelInterface ¶
type ModelInterface interface {
Connection() string
}
type MysqlConnector ¶
type MysqlConnector struct{}
func (*MysqlConnector) Connect ¶
func (i *MysqlConnector) Connect(conf DatabaseConfDriverInterface) *gorm.DB
Click to show internal directories.
Click to hide internal directories.