user

package
v0.0.0-...-629b230 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2021 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUserIsNilPointer = errors.New("cannot create user by nil user pointer")
)

Functions

func DeactivateUserByPhoneNumber

func DeactivateUserByPhoneNumber(phoneNumber string) error

func IsPhoneNumberUsed

func IsPhoneNumberUsed(phoneNumber string) (bool, error)

func UpdateProfile

func UpdateProfile(phoneNumber string, age uint8, address string) error

Types

type User

type User struct {
	basic.Model
	RealName     string `json:"real_name"`
	PasswordHash []byte `json:"-"`
	PhoneNumber  string `json:"phone_number" gorm:"uniqueIndex"`
	Age          uint8  `json:"age"`
	// Gender 性别,0:女,1:男
	Gender  uint8  `json:"gender"`
	Address string `json:"address"`
	// AccountStatus 帐号状态,0:正常,1:注销
	AccountStatus uint8      `json:"account_status"`
	RoleID        *uint8     `json:"-"`
	Role          *role.Role `json:"role"`
}

func GetUserByID

func GetUserByID(userID uint64) (*User, error)

func GetUserByPhoneNumber

func GetUserByPhoneNumber(phoneNumber string) (*User, error)

func (*User) Create

func (u *User) Create() error

func (*User) IsAllowedSignIn

func (u *User) IsAllowedSignIn() bool

func (*User) Save

func (u *User) Save() error

func (User) String

func (u User) String() string

Jump to

Keyboard shortcuts

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