model

package
v0.0.0-...-ab065fd Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DB *gorm.DB
)

Functions

func CheckPageSize

func CheckPageSize(page, pageSize int32) (int32, int32)

func DeleteUser

func DeleteUser(id uint) error

func Init

func Init()

Types

type TBUser

type TBUser struct {
	ID          uint
	CreatedAt   time.Time
	UpdatedAt   time.Time
	DeletedAt   *time.Time `sql:"index"`
	Uid         string     `gorm:"column:uid;type:varchar(100);unique_index" description:"uuid"`
	Username    string     `gorm:"column:username;type:varchar(100);unique_index" description:"账号"`
	Password    string     `gorm:"column:password;type:varchar(80);null" description:"密码"`
	Age         int32      `gorm:"column:age;not null" description:"年龄"`
	Address     string     `gorm:"column:address;type:varchar(250);null" description:"地址"`
	IsAvailable int8       `gorm:"column:is_available;null" description:"是否可用 1-可用 0-不可用" `
	LastLogin   time.Time  `gorm:"column:last_login;type(datetime);null" description:"最后登录时间"`
	LoginIp     string     `gorm:"column:login_ip;type:varchar(20);null" description:"登录IP"`
}

func GetUser

func GetUser(u *TBUser) (*TBUser, error)

func ListUsers

func ListUsers(username string, page, pageSize int32) (uint64, []*TBUser, error)

func (*TBUser) Create

func (t *TBUser) Create() error

func (*TBUser) Encrypt

func (t *TBUser) Encrypt() (err error)

func (*TBUser) TableName

func (t *TBUser) TableName() string

func (*TBUser) Update

func (t *TBUser) Update() error

func (*TBUser) Validate

func (t *TBUser) Validate() error

Jump to

Keyboard shortcuts

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