Documentation
¶
Index ¶
- Variables
- func Delete(db *gorm.DB, entity any)
- func FindCache[T any](db *gorm.DB, id uint64) *T
- func FindDatabase[T any](db *gorm.DB, id uint64) *T
- func FindOrigin[T any](db *gorm.DB, id uint64) *T
- func FindSnapshot[T any](db *gorm.DB, id uint64) *T
- func InitMySQL() error
- func Remove(db *gorm.DB, entity any)
- func Save(db *gorm.DB, entity any)
- type DBEntity
- type Entity
- type Operator
- type UmsEmployee
- type UmsMember
- type UmsUser
Constants ¶
This section is empty.
Variables ¶
View Source
var MySQL *gorm.DB
View Source
var MySQLContext = context.Background()
Functions ¶
func FindDatabase ¶
FindDatabase 获取数据库记录,包含删除标记的
func FindSnapshot ¶
FindSnapshot 获取缓存数据,不存在查询数据库,含删除标记的数据
Types ¶
type DBEntity ¶
type DBEntity interface { // GetEntity 获取实体基础结构体 GetEntity() *Entity // GetExpire 获取缓存失效时间,0不缓存 GetExpire() time.Duration }
DBEntity 实体接口
type Entity ¶
type Entity struct { ID uint64 `gorm:"column:C001;not null;primary_key;autoIncrement:false;comment:数据ID"` ZyxVersion uint64 `gorm:"column:C002;not null;comment:数据版本"` ZyxDelete bool `gorm:"column:C003;not null;index;comment:删除标记"` ZyxCreateTime time.Time `gorm:"column:C004;not null;index;comment:创建时间"` ZyxUpdateTime time.Time `gorm:"column:C005;not null;index;comment:修改时间"` }
Entity 实体基结构体
type Operator ¶
type Operator struct { ZyxCreateUid uint64 `gorm:"column:C008;not null;index;comment:创建人ID"` ZyxUpdateUid uint64 `gorm:"column:C009;not null;index;comment:修改人ID"` }
Operator 操作人相关字段
type UmsEmployee ¶
type UmsEmployee struct { Entity Operator Roles app.GormJSON `gorm:"column:B001;not null;type:json;comment:用户角色"` LoginKey string `gorm:"column:B010;not null;index;size:32;comment:登录账号"` LoginPwd string `gorm:"column:B011;not null;size:128;comment:登录密码"` Name string `gorm:"column:B020;not null;index;size:128;comment:用户名称"` Avatar string `gorm:"column:B021;not null;size:255;comment:用户头像地址"` }
UmsEmployee 平台用户信息表
func UmsEmployeeFindByLoginKey ¶
func UmsEmployeeFindByLoginKey(db *gorm.DB, loginKey string) *UmsEmployee
UmsEmployeeFindByLoginKey 获取指定登录账号的平台用户
type UmsMember ¶
type UmsMember struct { Entity Operator Roles app.GormJSON `gorm:"column:B001;not null;index;type:json;comment:用户角色"` LoginKey string `gorm:"column:B010;not null;index;size:32;comment:登录账号"` LoginPwd string `gorm:"column:B011;not null;size:128;comment:登录密码"` Mobile string `gorm:"column:B015;not null;index;size:16;comment:手机号"` Name string `gorm:"column:B020;not null;index;size:128;comment:用户名称"` Avatar string `gorm:"column:B021;not null;size:255;comment:用户头像地址"` }
UmsMember 平台用户信息表
func UmsMemberFindByLoginKey ¶
UmsMemberFindByLoginKey 获取指定登录账号的平台用户
type UmsUser ¶
type UmsUser struct { Entity Operator Type int8 `gorm:"column:B001;not null;index;comment:用户类型"` Name string `gorm:"column:B002;not null;size:128;comment:用户名称"` LastLoginTime time.Time `gorm:"column:B010;not null;comment:最后登录时间"` LastLoginIP string `gorm:"column:B011;not null;size:64;comment:最后登录IP"` LastLoginCity string `gorm:"column:B012;not null;size:128;comment:最后登录城市"` LastLoginDevice string `gorm:"column:B013;not null;size:128;comment:最后登录设备"` Lock bool `gorm:"column:B020;not null;index;comment:是否锁定登录"` LockTime time.Time `gorm:"column:B021;not null;comment:锁定时间"` LockResumeTime time.Time `gorm:"column:B022;not null;comment:解锁时间"` LockUserID uint64 `gorm:"column:B023;not null;comment:锁定人ID"` LockCause string `gorm:"column:B024;not null;size:256;comment:锁定原因"` }
UmsUser 用户信息
Click to show internal directories.
Click to hide internal directories.