userModel

package
v0.0.0-...-fdfd418 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type User

type User struct {
	UserId     int64  `json:"userId" gorm:"primary_key; auto_increment; not null"`         // 设置字段 userId 自增类型。
	Username   string `json:"username" gorm:"type:varchar(50); not null; unique"`          // 用户名
	Password   string `json:"-" gorm:"type:char(50); not null "`                           // 密码,json 返回忽略本字段
	Salt       string `json:"-" gorm:"type:char(6); not null"`                             // 密码盐值,json 返回忽略本字段
	Email      string `json:"email" gorm:"type:varchar(50); not null; unique; default ''"` // 邮箱
	IsAdmin    int8   `json:"isAdmin" gorm:"tinyint; not null; default 0"`                 // 是否是管理员 1:管理员 0:普通用户
	Status     int8   `json:"status" gorm:"tinyint; not null; default 0"`                  // 1: 正常 0:禁用
	CreateTime string `json:"createTime" gorm:"type:varchar(50); not null"`
	UpdateTime string `json:"updateTime" gorm:"type:varchar(50);"`
}

用户model

func (*User) ChangePassword

func (user *User) ChangePassword(userId int64, fieldMap map[string]interface{})

修改密码

func (*User) Delete

func (user *User) Delete(userId int64)

删除

func (*User) Detail

func (user *User) Detail(userId int64) *User

func (*User) Disable

func (user *User) Disable(userId int) int64

激活

func (*User) Enable

func (user *User) Enable(userId int) int64

激活

func (*User) GetInfoByName

func (user *User) GetInfoByName(username string) *User

根据 用户名获取用户信息

func (*User) IsExistsEmail

func (user *User) IsExistsEmail(email string) int64

邮箱是否存在

func (*User) IsExistsUsername

func (user *User) IsExistsUsername(username string) int64

用户名是否存在

func (*User) List

func (user *User) List(page int, pageSize int, username string) ([]User, int64)

func (*User) Save

func (user *User) Save()

新增

func (*User) Update

func (user *User) Update(userId int64, fieldMap map[string]interface{})

修改

Jump to

Keyboard shortcuts

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