Documentation ¶
Overview ¶
Package gorm is a wrapper for gorm.
Index ¶
Constants ¶
Variables ¶
View Source
var ( // ErrRecordNotFound returns a "record not found error". Occurs only when attempting to query the database with a struct; querying with a slice won't return this error ErrRecordNotFound = gorm.ErrRecordNotFound // ErrInvalidTransaction occurs when you are trying to `Commit` or `Rollback` ErrInvalidTransaction = gorm.ErrInvalidTransaction )
Functions ¶
func RegisterDataBase ¶
RegisterDataBase 注册一个别名的DB
Types ¶
type Association ¶
type Association = gorm.Association //nolint
type Config ¶
type Config struct { Alias string `mapstructure:"alias" json:"alias"` Driver string `mapstructure:"driver" json:"driver"` Server string `mapstructure:"server" json:"server"` Port int `mapstructure:"port" json:"port"` Database string `mapstructure:"database" json:"database"` User string `mapstructure:"user" json:"user"` Password string `mapstructure:"password" json:"password"` MaxIdleConns int `mapstructure:"maxIdleConns" json:"maxIdleConns"` MaxOpenConns int `mapstructure:"maxOpenConns" json:"maxOpenConns"` Charset string `mapstructure:"charset" json:"charset"` TimeZone string `mapstructure:"timezone" json:"timezone"` MaxLeftTime time.Duration `mapstructure:"maxLeftTime" json:"maxLeftTime"` }
Config 是gorm的配置文件字段定义
type DBConditions ¶
type DBConditions struct { And map[string]interface{} Or map[string]interface{} Not map[string]interface{} Limit int Offset int Order interface{} Select interface{} Group string Having interface{} NeedCount bool Count int64 Distinct interface{} // grom v1 暂不支持 }
DBConditions DB常用的查询条件封装
Source Files ¶
Click to show internal directories.
Click to hide internal directories.