userModel

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2024 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

Variables

This section is empty.

Functions

This section is empty.

Types

type AddData

type AddData struct {
	Username string
	Password string
	Email    string
}

type AddMode

type AddMode string
const (
	FriendAddModeOfFriendInvitation   AddMode = "friendInvitation"
	FriendAddModeOfFriendOnInvitation AddMode = "friendOnInvitation"
	FriendAddModeOfAccountInvitation  AddMode = "accountInvitation"
)

type Client

type Client interface {
	commonModel.Model
	GetByUser(User) error
	CheckUserAgent(userAgent string) bool
	InitByUser(User, *gorm.DB) error
	GetUserId() uint
	IsCurrentAccount(accountId uint) bool
	IsCurrentShareAccount(accountId uint) bool
}

func GetUserClientModel

func GetUserClientModel(client constant.Client) Client

type ClientMap

type ClientMap map[constant.Client]Client

func GetClients

func GetClients() ClientMap

type Condition

type Condition struct {
	Id                 *uint
	LikePrefixUsername *string
	Offset             int
	Limit              int
}

type Flag

type Flag uint
const (
	FLAG_AMOUNT Flag = 1 << iota
	FLAG_CATEGORY
	FLAG_TRADE_TIME
	FLAG_ACCOUNT
	FLAG_CREATE_TIME
	FLAG_UPDATE_TIME
	FLAG_REMARK
)

type Friend

type Friend struct {
	ID        uint `gorm:"primarykey"`
	UserId    uint `gorm:"uniqueIndex:idx_mapping,priority:1"`
	FriendId  uint `gorm:"uniqueIndex:idx_mapping,priority:2;"`
	AddMode   AddMode
	CreatedAt time.Time      `gorm:"type:TIMESTAMP"`
	UpdatedAt time.Time      `gorm:"type:TIMESTAMP"`
	DeletedAt gorm.DeletedAt `gorm:"index;type:TIMESTAMP"`
}

func (*Friend) GetFriend

func (f *Friend) GetFriend(args ...interface{}) (User, error)

func (*Friend) GetFriendInfo

func (f *Friend) GetFriendInfo() (info UserInfo, err error)

func (*Friend) TableName

func (f *Friend) TableName() string

type FriendInvitation

type FriendInvitation struct {
	ID        uint `gorm:"primarykey"`
	Inviter   uint `gorm:"uniqueIndex:idx_mapping,priority:1"`
	Invitee   uint `gorm:"uniqueIndex:idx_mapping,priority:2"`
	Status    FriendInvitationStatus
	CreatedAt time.Time      `gorm:"type:TIMESTAMP"`
	UpdatedAt time.Time      `gorm:"type:TIMESTAMP"`
	DeletedAt gorm.DeletedAt `gorm:"index;type:TIMESTAMP"`
}

邀请

func (*FriendInvitation) Accept

func (f *FriendInvitation) Accept(tx *gorm.DB) (inviterFriend Friend, inviteeFriend Friend, err error)

func (*FriendInvitation) AddFriend

func (f *FriendInvitation) AddFriend(tx *gorm.DB) (inviterFriend Friend, inviteeFriend Friend, err error)

func (*FriendInvitation) ForShare

func (f *FriendInvitation) ForShare(tx *gorm.DB) error

func (*FriendInvitation) ForUpdate

func (f *FriendInvitation) ForUpdate(tx *gorm.DB) error

func (*FriendInvitation) GetInviteeInfo

func (f *FriendInvitation) GetInviteeInfo() (UserInfo, error)

func (*FriendInvitation) GetInviterInfo

func (f *FriendInvitation) GetInviterInfo() (UserInfo, error)

func (*FriendInvitation) Refuse

func (f *FriendInvitation) Refuse(tx *gorm.DB) error

func (*FriendInvitation) TableName

func (f *FriendInvitation) TableName() string

func (*FriendInvitation) UpdateStatus

func (f *FriendInvitation) UpdateStatus(status FriendInvitationStatus, tx *gorm.DB) error

type FriendInvitationStatus

type FriendInvitationStatus int
const (
	InvitationStatsOfWaiting FriendInvitationStatus = iota
	InvitationStatsOfAccept
	InvitationStatsOfRefuse
)

type Log

type Log struct {
	ID        uint                `gorm:"primarykey"`
	UserId    uint                `gorm:"comment:用户id;not null"`
	Action    constant.UserAction `gorm:"comment:操作;not null;size:32"`
	Remark    string              `gorm:"comment:备注;not null;size:255"`
	CreatedAt time.Time           `gorm:"type:TIMESTAMP"`
	UpdatedAt time.Time           `gorm:"type:TIMESTAMP"`
	DeletedAt gorm.DeletedAt      `gorm:"index;type:TIMESTAMP"`
	commonModel.BaseModel
}

func (*Log) IsEmpty

func (l *Log) IsEmpty() bool

func (*Log) TableName

func (l *Log) TableName() string

type LogAddData

type LogAddData struct {
	Action constant.UserAction
	Remark string
}

type LogDao

type LogDao struct {
	// contains filtered or unexported fields
}

func NewLogDao

func NewLogDao(db *gorm.DB) *LogDao

func (*LogDao) Add

func (l *LogDao) Add(user User, data *LogAddData) (*Log, error)

type Tour

type Tour struct {
	UserId    uint `gorm:"primary"`
	Status    bool
	CreatedAt time.Time      `gorm:"type:TIMESTAMP"`
	UpdatedAt time.Time      `gorm:"type:TIMESTAMP"`
	DeletedAt gorm.DeletedAt `gorm:"index;type:TIMESTAMP"`
	commonModel.BaseModel
}

func (*Tour) GetUser

func (t *Tour) GetUser(db *gorm.DB) (user User, err error)

func (*Tour) TableName

func (u *Tour) TableName() string

func (*Tour) Use

func (t *Tour) Use(db *gorm.DB) error

type TransactionShareConfig

type TransactionShareConfig struct {
	ID           uint           `gorm:"primarykey"`
	UserId       uint           `gorm:"comment:'用户ID';unique"`
	DisplayFlags Flag           `gorm:"comment:'展示字段标志'"`
	CreatedAt    time.Time      `gorm:"type:TIMESTAMP"`
	UpdatedAt    time.Time      `gorm:"type:TIMESTAMP"`
	DeletedAt    gorm.DeletedAt `gorm:"index;type:TIMESTAMP"`
}

func (*TransactionShareConfig) ClosedDisplayFlag

func (u *TransactionShareConfig) ClosedDisplayFlag(flag Flag, db *gorm.DB) error

func (*TransactionShareConfig) GetFlagStatus

func (u *TransactionShareConfig) GetFlagStatus(flag Flag) bool

func (*TransactionShareConfig) OpenDisplayFlag

func (u *TransactionShareConfig) OpenDisplayFlag(flag Flag, db *gorm.DB) error

func (*TransactionShareConfig) SelectByUserId

func (u *TransactionShareConfig) SelectByUserId(userId uint) error

func (*TransactionShareConfig) TableName

func (u *TransactionShareConfig) TableName() string

type User

type User struct {
	ID        uint           `gorm:"primarykey"`
	Username  string         `gorm:"type:varchar(128);comment:'用户名'"`
	Password  string         `gorm:"type:char(64);comment:'密码'"`
	Email     string         `gorm:"type:varchar(64);comment:'邮箱';unique"`
	CreatedAt time.Time      `gorm:"type:TIMESTAMP"`
	UpdatedAt time.Time      `gorm:"type:TIMESTAMP"`
	DeletedAt gorm.DeletedAt `gorm:"index;type:TIMESTAMP"`
	commonModel.BaseModel
}

func (*User) GetTransactionShareConfig

func (u *User) GetTransactionShareConfig() (TransactionShareConfig, error)

func (*User) GetUserClient

func (u *User) GetUserClient(client constant.Client, db *gorm.DB) (clientInfo UserClientBaseInfo, err error)

func (*User) IsTourist

func (u *User) IsTourist(db *gorm.DB) (bool, error)

func (*User) ModifyAsTourist

func (u *User) ModifyAsTourist(db *gorm.DB) error

func (*User) SelectById

func (u *User) SelectById(id uint, selects ...interface{}) error

type UserClientAndroid

type UserClientAndroid struct {
	UserClientBaseInfo
	Version      string
	DeviceNumber string `gorm:"uniqueIndex;default:null;"`
	commonModel.BaseModel
}

func (*UserClientAndroid) CheckUserAgent

func (a *UserClientAndroid) CheckUserAgent(userAgent string) bool

func (*UserClientAndroid) GetByUser

func (a *UserClientAndroid) GetByUser(user User) error

func (*UserClientAndroid) InitByUser

func (a *UserClientAndroid) InitByUser(user User, tx *gorm.DB) error

func (*UserClientAndroid) IsEmpty

func (a *UserClientAndroid) IsEmpty() bool

type UserClientBaseInfo

type UserClientBaseInfo struct {
	UserId                uint `gorm:"primaryKey;autoIncrement:false"`
	CurrentAccountId      uint
	CurrentShareAccountId uint
	LoginTime             time.Time `gorm:"type:TIMESTAMP"`
}

func (*UserClientBaseInfo) CheckUserAgent

func (u *UserClientBaseInfo) CheckUserAgent(string) bool

func (*UserClientBaseInfo) GetByUser

func (u *UserClientBaseInfo) GetByUser(User) error

func (*UserClientBaseInfo) GetUserId

func (uci *UserClientBaseInfo) GetUserId() uint

func (*UserClientBaseInfo) IsCurrentAccount

func (uci *UserClientBaseInfo) IsCurrentAccount(accountId uint) bool

func (*UserClientBaseInfo) IsCurrentShareAccount

func (uci *UserClientBaseInfo) IsCurrentShareAccount(accountId uint) bool

type UserClientIos

type UserClientIos struct {
	UserClientBaseInfo
	Version      string
	DeviceNumber string `gorm:"uniqueIndex;default:null;"`
	commonModel.BaseModel
}

func (*UserClientIos) CheckUserAgent

func (i *UserClientIos) CheckUserAgent(userAgent string) bool

func (*UserClientIos) GetByUser

func (i *UserClientIos) GetByUser(user User) error

func (*UserClientIos) InitByUser

func (i *UserClientIos) InitByUser(user User, tx *gorm.DB) error

func (*UserClientIos) IsEmpty

func (i *UserClientIos) IsEmpty() bool

type UserClientWeb

type UserClientWeb struct {
	UserClientBaseInfo
	WebName string
	commonModel.BaseModel
}

func (*UserClientWeb) CheckUserAgent

func (w *UserClientWeb) CheckUserAgent(userAgent string) bool

func (*UserClientWeb) GetByUser

func (w *UserClientWeb) GetByUser(user User) error

func (*UserClientWeb) InitByUser

func (w *UserClientWeb) InitByUser(user User, tx *gorm.DB) error

func (*UserClientWeb) IsEmpty

func (w *UserClientWeb) IsEmpty() bool

type UserDao

type UserDao struct {
	// contains filtered or unexported fields
}

func NewDao

func NewDao(db ...*gorm.DB) *UserDao

func (*UserDao) Add

func (u *UserDao) Add(data AddData) (User, error)

func (*UserDao) AddFriend

func (u *UserDao) AddFriend(userId uint, friendId uint, add AddMode) (mapping Friend, err error)

func (*UserDao) CheckEmail

func (u *UserDao) CheckEmail(email string) error

func (*UserDao) CreateFriendInvitation

func (u *UserDao) CreateFriendInvitation(inviter uint, invitee uint) (FriendInvitation, error)

func (*UserDao) CreateTour

func (u *UserDao) CreateTour(user User) (Tour, error)

func (*UserDao) IsRealFriend

func (u *UserDao) IsRealFriend(userId uint, friendId uint) (bool, error)

func (*UserDao) PluckNameById

func (u *UserDao) PluckNameById(id uint) (string, error)

func (*UserDao) SelectByDeviceNumber

func (u *UserDao) SelectByDeviceNumber(client constant.Client, deviceNumber string) (
	clientBaseInfo UserClientBaseInfo,
	err error)

func (*UserDao) SelectByEmail

func (u *UserDao) SelectByEmail(email string) (User, error)

func (*UserDao) SelectById

func (u *UserDao) SelectById(id uint, args ...interface{}) (User, error)

func (*UserDao) SelectByUnusedTour

func (u *UserDao) SelectByUnusedTour() (tour Tour, err error)

func (*UserDao) SelectClientInfoByUserAndAccount

func (u *UserDao) SelectClientInfoByUserAndAccount(
	client constant.Client, userId, accountId uint,
) (result []UserClientBaseInfo, err error)

func (*UserDao) SelectFriend

func (u *UserDao) SelectFriend(userId uint, friendId uint) (Friend, error)

func (*UserDao) SelectFriendInvitation

func (u *UserDao) SelectFriendInvitation(inviter uint, invitee uint, forUpdate bool) (
	result FriendInvitation, err error,
)

func (*UserDao) SelectFriendInvitationList

func (u *UserDao) SelectFriendInvitationList(inviter *uint, invitee *uint) (result []FriendInvitation, err error)

func (*UserDao) SelectFriendList

func (u *UserDao) SelectFriendList(userId uint) (result []Friend, err error)

func (*UserDao) SelectTour

func (u *UserDao) SelectTour(userId uint) (Tour, error)

func (*UserDao) SelectUserClient

func (u *UserDao) SelectUserClient(userId uint, client constant.Client) (Client, error)

func (*UserDao) SelectUserClientBaseInfo

func (u *UserDao) SelectUserClientBaseInfo(userId uint, client constant.Client) (result UserClientBaseInfo, err error)

func (*UserDao) SelectUserInfoByCondition

func (u *UserDao) SelectUserInfoByCondition(condition Condition) ([]UserInfo, error)

func (*UserDao) SelectUserInfoById

func (u *UserDao) SelectUserInfoById(id uint) (result UserInfo, err error)

func (*UserDao) UpdateUserClientBaseInfo

func (u *UserDao) UpdateUserClientBaseInfo(userId uint, client constant.Client) (result UserClientBaseInfo, err error)

type UserInfo

type UserInfo struct {
	ID       uint
	Username string
	Email    string
}

Jump to

Keyboard shortcuts

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