Documentation ¶
Index ¶
- Variables
- func GetUserDB(ctx context.Context, defDB *gorm.DB) *gorm.DB
- func GetUserRoleDB(ctx context.Context, defDB *gorm.DB) *gorm.DB
- type SchemaUser
- type SchemaUserRole
- type User
- type UserRepo
- func (a *UserRepo) Create(ctx context.Context, item schema.User) error
- func (a *UserRepo) Delete(ctx context.Context, id uint64) error
- func (a *UserRepo) Get(ctx context.Context, id uint64, opts ...schema.UserQueryOptions) (*schema.User, error)
- func (a *UserRepo) Query(ctx context.Context, params schema.UserQueryParam, ...) (*schema.UserQueryResult, error)
- func (a *UserRepo) Update(ctx context.Context, id uint64, item schema.User) error
- func (a *UserRepo) UpdatePassword(ctx context.Context, id uint64, password string) error
- func (a *UserRepo) UpdateStatus(ctx context.Context, id uint64, status int) error
- type UserRole
- type UserRoleRepo
- func (a *UserRoleRepo) Create(ctx context.Context, item schema.UserRole) error
- func (a *UserRoleRepo) Delete(ctx context.Context, id uint64) error
- func (a *UserRoleRepo) DeleteByUserID(ctx context.Context, userID uint64) error
- func (a *UserRoleRepo) Get(ctx context.Context, id uint64, opts ...schema.UserRoleQueryOptions) (*schema.UserRole, error)
- func (a *UserRoleRepo) Query(ctx context.Context, params schema.UserRoleQueryParam, ...) (*schema.UserRoleQueryResult, error)
- func (a *UserRoleRepo) Update(ctx context.Context, id uint64, item schema.UserRole) error
- type UserRoles
- type Users
Constants ¶
This section is empty.
Variables ¶
View Source
var UserRoleSet = wire.NewSet(wire.Struct(new(UserRoleRepo), "*"))
UserRoleSet 注入UserRole
UserSet 注入User
Functions ¶
Types ¶
type SchemaUser ¶
SchemaUser 用户对象
type SchemaUserRole ¶
SchemaUserRole 用户角色
func (SchemaUserRole) ToUserRole ¶
func (a SchemaUserRole) ToUserRole() *UserRole
ToUserRole 转换为角色菜单实体
type User ¶
type User struct { util.Model UserName string `gorm:"size:64;uniqueIndex;default:'';not null;"` // 用户名 RealName string `gorm:"size:64;index;default:'';"` // 真实姓名 Password string `gorm:"size:40;default:'';"` // 密码(sha1(md5(明文))) Email *string `gorm:"size:255;"` // 邮箱 Phone *string `gorm:"size:20;"` // 手机号 Status int `gorm:"index;default:0;"` // 状态(1:启用 2:停用) Creator uint64 `gorm:""` // 创建者 }
User 用户实体
type UserRepo ¶
UserRepo 用户存储
func (*UserRepo) Get ¶
func (a *UserRepo) Get(ctx context.Context, id uint64, opts ...schema.UserQueryOptions) (*schema.User, error)
Get 查询指定数据
func (*UserRepo) Query ¶
func (a *UserRepo) Query(ctx context.Context, params schema.UserQueryParam, opts ...schema.UserQueryOptions) (*schema.UserQueryResult, error)
Query 查询数据
func (*UserRepo) UpdatePassword ¶
UpdatePassword 更新密码
type UserRole ¶
type UserRole struct { util.Model UserID uint64 `gorm:"index;default:0;"` // 用户内码 RoleID uint64 `gorm:"index;default:0;"` // 角色内码 }
UserRole 用户角色关联实体
func (UserRole) ToSchemaUserRole ¶
ToSchemaUserRole 转换为用户角色对象
type UserRoleRepo ¶
UserRoleRepo 用户角色存储
func (*UserRoleRepo) Delete ¶
func (a *UserRoleRepo) Delete(ctx context.Context, id uint64) error
Delete 删除数据
func (*UserRoleRepo) DeleteByUserID ¶
func (a *UserRoleRepo) DeleteByUserID(ctx context.Context, userID uint64) error
DeleteByUserID 根据用户ID删除数据
func (*UserRoleRepo) Get ¶
func (a *UserRoleRepo) Get(ctx context.Context, id uint64, opts ...schema.UserRoleQueryOptions) (*schema.UserRole, error)
Get 查询指定数据
func (*UserRoleRepo) Query ¶
func (a *UserRoleRepo) Query(ctx context.Context, params schema.UserRoleQueryParam, opts ...schema.UserRoleQueryOptions) (*schema.UserRoleQueryResult, error)
Query 查询数据
type UserRoles ¶
type UserRoles []*UserRole
UserRoles 用户角色关联列表
func (UserRoles) ToSchemaUserRoles ¶
ToSchemaUserRoles 转换为用户角色对象列表
Click to show internal directories.
Click to hide internal directories.