Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Host string `toml:"host" json:"host"`
Port int `toml:"port" json:"port"`
User string `toml:"user" json:"user"`
Passwd string `toml:"passwd" json:"passwd"`
DBName string `toml:"dbname" json:"dbname"`
MaxIdleConns int `toml:"max_idle_conns" json:"max_idle_conns"`
MaxOpenConns int `toml:"max_open_conns" json:"max_open_conns"`
ConnMaxIdletime int `toml:"conn_max_idletime" json:"conn_max_idletime"`
ConnMaxLifetime int `toml:"conn_max_lifetime" json:"conn_max_lifetime"`
}
type MysqlComponent ¶
type MysqlComponent struct {
DBMap map[string]*gorm.DB `toml:"-"`
Configs []Config `toml:"configs" json:"configs"`
}
func NewGormDatabase ¶
func NewGormDatabase(conf config.ConfigMate) *MysqlComponent
func (*MysqlComponent) GetDatabase ¶
func (mc *MysqlComponent) GetDatabase(dbName string, dst ...any) *gorm.DB
func (*MysqlComponent) Name ¶
func (mc *MysqlComponent) Name() string
Click to show internal directories.
Click to hide internal directories.