Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DataFactory ¶
type DataFactory interface {
User() UserStore
}
type UserDO ¶
type UserDO struct {
BaseModel
Mobile string `gorm:"index:idx_mobile;unique;type:varchar(11);not null;comment:手机号"`
Password string `gorm:"type:varchar(100);not null;comment:密码"`
NickName string `gorm:"type:varchar(20);comment:账号名称"`
Birthday *time.Time `gorm:"type:datetime;comment:出生日期"`
Gender string `gorm:"column:gender;default:male;type:varchar(6);comment:femail表示女,male表示男"`
Role int `gorm:"column:role;default:1;type:int;comment:1表示普通用户,2表示管理员"`
}
type UserDOList ¶
type UserStore ¶
type UserStore interface {
/*
有数据访问的方法,一定要有error
参数中最好有ctx 可能需要cancel / telemetry等
*/
//用户列表 - 后台管理系统
List(ctx context.Context, orderby []string, opts metav1.ListMeta) (*UserDOList, error)
//通过手机号码查询用户
GetByMobile(ctx context.Context, mobile string) (*UserDO, error)
//通过用户ID查询用户
GetByID(ctx context.Context, id uint64) (*UserDO, error)
//创建用户
Create(ctx context.Context, user *UserDO) error
//更新用户
Update(ctx context.Context, user *UserDO) error
}
Click to show internal directories.
Click to hide internal directories.