package
1.6.23
Repository: https://github.com/mittacy/ego.git
Documentation: pkg.go.dev

# Functions

GetGorm 获取gorm连接 @param name 配置名 @return *gorm.DB.
InitGorm 函数功能说明 @param connectConf Example: connectConf = map[string]Conf{ "localhost": { Host: viper.GetString("DB_CORE_RW_HOST"), Port: viper.GetInt("DB_CORE_RW_PORT"), Database: viper.GetString("DB_CORE_RW_DATABASE"), User: viper.GetString("DB_CORE_RW_USERNAME"), Password: viper.GetString("DB_CORE_RW_PASSWORD"), }, } @param options gorm配置 WithLogName 配置日志名 WithLogSlowThreshold 配置慢日志阈值 WithLogIgnoreRecordNotFound 配置是否忽略记录未找到错误.
InitMysqlConf 函数功能说明 Example: c = map[string]Conf{ "localhost": { Host: viper.GetString("DB_CORE_RW_HOST"), Port: viper.GetInt("DB_CORE_RW_PORT"), Database: viper.GetString("DB_CORE_RW_DATABASE"), User: viper.GetString("DB_CORE_RW_USERNAME"), Password: viper.GetString("DB_CORE_RW_PASSWORD"), }, } @param c.
NewGormConnect 获取新客户端 @param conf 配置信息 @return *gorm.DB gorm连接 @return error.
No description provided by the author
No description provided by the author
No description provided by the author

# Variables

No description provided by the author

# Structs

No description provided by the author
EGorm 在结构体引入组合并赋值ConfName,即可通过GDB()获取gorm连接 Example type User struct { EGorm } var user = User{EGorm{ConfName: "localhost"}} func (u *User) GetUser(id int64) error { u.GDB().Where("id = ?", id).First() }.

# Type aliases

No description provided by the author