Documentation
¶
Index ¶
- func Create(entity *Entity) error
- func ExistEmail(email string) bool
- func ExistUsername(username string) bool
- func GetCount() int64
- func GetMapByIds(userIds []uint64) map[uint64]*Entity
- func GetMaxId() uint64
- func IncrementPrestige(addNumber int64, userId uint64) int64
- func Page(q PageQuery) struct{ ... }
- func Save(entity *Entity) error
- type Entity
- func All() (entities []*Entity)
- func Get(id any) (entity Entity, err error)
- func GetByIds(userIds []uint64) (entities []*Entity)
- func GetByUsername(username string) (entities *Entity)
- func MakeUser(name string, password string, email string) *Entity
- func Verify(username string, password string) (*Entity, error)
- type PageQuery
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetMapByIds ¶
func IncrementPrestige ¶
Types ¶
type Entity ¶
type Entity struct {
Id uint64 `gorm:"primaryKey;column:id;autoIncrement;not null;" json:"id"` //
Username string `gorm:"column:username;type:varchar(255);not null;default:'';" json:"username"` //
Nickname string `gorm:"column:nickname;type:varchar(255);not null;default:'';" json:"nickname"` //
Email string `gorm:"column:email;type:varchar(255);not null;default:'';" json:"email"` //
Password string `gorm:"column:password;type:varchar(255);not null;default:'';" json:"password"` //
MobileAreaCode string `gorm:"column:mobile_area_code;type:varchar(16);" json:"mobileAreaCode"` //
MobilePhoneNumber string `gorm:"column:mobile_phone_number;type:varchar(64);" json:"mobilePhoneNumber"` //
Status int8 `gorm:"column:status;type:tinyint;not null;default:0;" json:"status"` // 状态:0正常 1冻结
Validate int8 `gorm:"column:validate;type:tinyint;not null;default:0;" json:"validate"` // 是否验证通过: 0未通过/未验证 1 验证通过
ActivatedAt time.Time `gorm:"column:activated_at;type:datetime;" json:"activatedAt"` // 激活时间
Prestige int64 `gorm:"column:prestige;type:bigint;not null;default:0;" json:"prestige"` // 声望
AvatarUrl string `gorm:"column:avatar_url;type:varchar(255);" json:"avatarUrl"` // 头像URL
Bio string `gorm:"column:bio;type:varchar(500);" json:"bio"` // 个人简介
Signature string `gorm:"column:signature;type:varchar(255);" json:"signature"` // 署名
Website string `gorm:"column:website;type:varchar(255);" json:"website"` // 个人网站
CreatedAt time.Time `gorm:"column:created_at;index;autoCreateTime;" json:"createdAt"` //
UpdatedAt time.Time `gorm:"column:updated_at;autoUpdateTime;" json:"updatedAt"`
DeletedAt *time.Time `gorm:"column:deleted_at;type:datetime;" json:"deletedAt"` //
}
func GetByUsername ¶
func (*Entity) GetWebAvatarUrl ¶
func (*Entity) SetPassword ¶
Click to show internal directories.
Click to hide internal directories.