model

package
v0.0.0-...-592b0ac Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrDuplicate = errors.New("sql: duplicate key")
View Source
var ErrNotFound = sqlx.ErrNotFound

Functions

This section is empty.

Types

type Keys

type Keys struct {
	Key   string
	Value interface{}
}

type UserCore

type UserCore struct {
	Uid         int64        `db:"uid"`      // 用户id
	UserName    string       `db:"userName"` // 登录用户名
	Password    string       `db:"password"` // 登录密码
	Email       string       `db:"email"`    // 邮箱
	Phone       string       `db:"phone"`    // 手机号
	Wechat      string       `db:"wechat"`   // 微信UnionID
	LastIP      string       `db:"lastIP"`   // 最后登录ip
	RegIP       string       `db:"regIP"`    // 注册ip
	CreatedTime sql.NullTime `db:"createdTime"`
	UpdatedTime sql.NullTime `db:"updatedTime"`
	DeletedTime sql.NullTime `db:"deletedTime"`
	Status      int64        `db:"status"` // 用户状态:0为未注册状态
}

type UserCoreModel

type UserCoreModel interface {
	Insert(data UserCore) (sql.Result, error)
	FindOne(uid int64) (*UserCore, error)
	FindOneByEmail(email string) (*UserCore, error)
	FindOneByPhone(phone string) (*UserCore, error)
	FindOneByUserName(userName string) (*UserCore, error)
	FindOneByWechat(wechat string) (*UserCore, error)
	Update(data UserCore) error
	Delete(uid int64) error
}

func NewUserCoreModel

func NewUserCoreModel(conn sqlx.SqlConn, c cache.CacheConf) UserCoreModel

type UserInfo

type UserInfo struct {
	Uid         int64        `db:"uid"`        // 用户id
	UserName    string       `db:"userName"`   // 用户名
	NickName    string       `db:"nickName"`   // 用户的昵称
	InviterUid  int64        `db:"inviterUid"` // 邀请人用户id
	InviterId   string       `db:"inviterId"`  // 邀请码
	Sex         int64        `db:"sex"`        // 用户的性别,值为1时是男性,值为2时是女性,值为0时是未知
	City        string       `db:"city"`       // 用户所在城市
	Country     string       `db:"country"`    // 用户所在国家
	Province    string       `db:"province"`   // 用户所在省份
	Language    string       `db:"language"`   // 用户的语言,简体中文为zh_CN
	HeadImgUrl  string       `db:"headImgUrl"` // 用户头像
	CreatedTime sql.NullTime `db:"createdTime"`
	UpdatedTime sql.NullTime `db:"updatedTime"`
	DeletedTime sql.NullTime `db:"deletedTime"`
}

type UserInfoModel

type UserInfoModel interface {
	Insert(data UserInfo) (sql.Result, error)
	InsertOrUpdate(data UserInfo) error
	FindOne(uid int64) (*UserInfo, error)
	Update(data UserInfo) error
	Delete(uid int64) error
}

func NewUserInfoModel

func NewUserInfoModel(conn sqlx.SqlConn, c cache.CacheConf) UserInfoModel

type UserModel

type UserModel interface {
	RegisterCore(data UserCore, key Keys) (sql.Result, error)
}

func NewUserModel

func NewUserModel(conn sqlx.SqlConn, c cache.CacheConf) UserModel

Jump to

Keyboard shortcuts

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