Documentation
¶
Index ¶
- func SetFieldIfExist(model interface{}, fieldName string, value string)
- type MysqlBaseModel
- func (b *MysqlBaseModel) BeforeCreate(tx *gorm.DB) (err error)
- func (b *MysqlBaseModel) BeforeUpdate(tx *gorm.DB) (err error)
- func (b *MysqlBaseModel) GetConfigAlias(model interface{}) string
- func (b *MysqlBaseModel) ModelParse(modelType reflect.Type) (tableName string, fields []string, softDeleteField string, ...)
- type SqliteBaseModel
- func (b *SqliteBaseModel) BeforeCreate(tx *gorm.DB) (err error)
- func (b *SqliteBaseModel) BeforeUpdate(tx *gorm.DB) (err error)
- func (b *SqliteBaseModel) GetConfigAlias(model interface{}) string
- func (b *SqliteBaseModel) ModelParse(modelType reflect.Type) (tableName string, fields []string, softDeleteField string, ...)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetFieldIfExist ¶ added in v0.10.4
SetFieldIfExist 设置字段值(如果字段存在且可设置) 支持字符串类型和时间类型字段的自动设置 参数说明:
- model interface{}: 要设置字段值的模型对象
- fieldName string: 字段名称
- value string: 字段值(字符串格式的时间)
Types ¶
type MysqlBaseModel ¶
type MysqlBaseModel struct {
}
MysqlBaseModel gorm基础模型
func (*MysqlBaseModel) BeforeCreate ¶
func (b *MysqlBaseModel) BeforeCreate(tx *gorm.DB) (err error)
func (*MysqlBaseModel) BeforeUpdate ¶
func (b *MysqlBaseModel) BeforeUpdate(tx *gorm.DB) (err error)
func (*MysqlBaseModel) GetConfigAlias ¶
func (b *MysqlBaseModel) GetConfigAlias(model interface{}) string
func (*MysqlBaseModel) ModelParse ¶
func (b *MysqlBaseModel) ModelParse(modelType reflect.Type) (tableName string, fields []string, softDeleteField string, softDeleteCondition string)
ModelParse 解析模型信息(供 CRUD trait 使用) 参数说明:
- modelType reflect.Type: 模型的反射类型
返回值:
- tableName string: 数据表名称
- fields []string: 字段列表
- softDeleteField string: 软删除字段名
- softDeleteCondition string: 软删除条件
type SqliteBaseModel ¶
type SqliteBaseModel struct {
}
SqliteBaseModel gorm基础模型
func (*SqliteBaseModel) BeforeCreate ¶
func (b *SqliteBaseModel) BeforeCreate(tx *gorm.DB) (err error)
func (*SqliteBaseModel) BeforeUpdate ¶
func (b *SqliteBaseModel) BeforeUpdate(tx *gorm.DB) (err error)
func (*SqliteBaseModel) GetConfigAlias ¶ added in v0.11.1
func (b *SqliteBaseModel) GetConfigAlias(model interface{}) string
func (*SqliteBaseModel) ModelParse ¶
func (b *SqliteBaseModel) ModelParse(modelType reflect.Type) (tableName string, fields []string, softDeleteField string, softDeleteCondition string)
ModelParse 解析模型信息(供 CRUD trait 使用) 参数说明:
- modelType reflect.Type: 模型的反射类型
返回值:
- tableName string: 数据表名称
- fields []string: 字段列表
- softDeleteField string: 软删除字段名
- softDeleteCondition string: 软删除条件
Click to show internal directories.
Click to hide internal directories.