user

package
v8.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 22, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var UserRoleSet = wire.NewSet(wire.Struct(new(UserRoleRepo), "*"))
View Source
var UserSet = wire.NewSet(wire.Struct(new(UserRepo), "*"))

Functions

func GetUserDB

func GetUserDB(ctx context.Context, defDB *gorm.DB) *gorm.DB

func GetUserRoleDB

func GetUserRoleDB(ctx context.Context, defDB *gorm.DB) *gorm.DB

Types

type SchemaUser

type SchemaUser schema.User

func (SchemaUser) ToUser

func (a SchemaUser) ToUser() *User

type SchemaUserRole

type SchemaUserRole schema.UserRole

func (SchemaUserRole) ToUserRole

func (a SchemaUserRole) ToUserRole() *UserRole

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:'';"`                      // 密码
	Email    *string `gorm:"size:255;"`                                // 邮箱
	Phone    *string `gorm:"size:20;"`                                 // 手机号
	Status   int     `gorm:"index;default:0;"`                         // 状态(1:启用 2:停用)
	Creator  uint64  `gorm:""`                                         // 创建者
}

func (User) ToSchemaUser

func (a User) ToSchemaUser() *schema.User

type UserRepo

type UserRepo struct {
	DB *gorm.DB
}

func (*UserRepo) Create

func (a *UserRepo) Create(ctx context.Context, item schema.User) error

func (*UserRepo) Delete

func (a *UserRepo) Delete(ctx context.Context, id uint64) error

func (*UserRepo) Get

func (a *UserRepo) Get(ctx context.Context, id uint64, opts ...schema.UserQueryOptions) (*schema.User, error)

func (*UserRepo) Query

func (*UserRepo) Update

func (a *UserRepo) Update(ctx context.Context, id uint64, item schema.User) error

func (*UserRepo) UpdatePassword

func (a *UserRepo) UpdatePassword(ctx context.Context, id uint64, password string) error

func (*UserRepo) UpdateStatus

func (a *UserRepo) UpdateStatus(ctx context.Context, id uint64, status int) error

type UserRole

type UserRole struct {
	util.Model
	UserID uint64 `gorm:"index;default:0;"` // 用户内码
	RoleID uint64 `gorm:"index;default:0;"` // 角色内码
}

func (UserRole) ToSchemaUserRole

func (a UserRole) ToSchemaUserRole() *schema.UserRole

type UserRoleRepo

type UserRoleRepo struct {
	DB *gorm.DB
}

func (*UserRoleRepo) Create

func (a *UserRoleRepo) Create(ctx context.Context, item schema.UserRole) error

func (*UserRoleRepo) Delete

func (a *UserRoleRepo) Delete(ctx context.Context, id uint64) error

func (*UserRoleRepo) DeleteByUserID

func (a *UserRoleRepo) DeleteByUserID(ctx context.Context, userID uint64) error

func (*UserRoleRepo) Get

func (*UserRoleRepo) Query

func (*UserRoleRepo) Update

func (a *UserRoleRepo) Update(ctx context.Context, id uint64, item schema.UserRole) error

type UserRoles

type UserRoles []*UserRole

func (UserRoles) ToSchemaUserRoles

func (a UserRoles) ToSchemaUserRoles() []*schema.UserRole

type Users

type Users []*User

func (Users) ToSchemaUsers

func (a Users) ToSchemaUsers() []*schema.User

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL