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 GetMonthCount() int64
- 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 GetByEmail(email string) (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 QueryById(startId uint64, limit int) (entities []*Entity)
- func Verify(usernameOrEmail string, password string) (*Entity, error)
- func (itself *Entity) Activate() error
- func (itself *Entity) GetExternalInformation() ExternalInformation
- func (itself *Entity) GetShowName() string
- func (itself *Entity) GetWebAvatarUrl() string
- func (itself *Entity) SetExternalInformation(info ExternalInformation)
- func (itself *Entity) SetPassword(password string) *Entity
- func (itself *Entity) TableName() string
- type ExternalInformation
- type ExternalInformationItem
- type PageQuery
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetMapByIds ¶
func GetMonthCount ¶ added in v0.0.3
func GetMonthCount() int64
func IncrementPrestige ¶
Types ¶
type Entity ¶
type Entity struct {
Id uint64 `gorm:"primaryKey;column:id;autoIncrement;not null;" json:"id"` //
Username string `gorm:"column:username;index;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;index;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"` //
RoleId uint64 `gorm:"column:role_id;type:bigint unsigned;not null;default:0;" json:"roleId"` //
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"` // 个人网站
WebsiteName string `gorm:"column:website_name;type:varchar(64);" json:"websiteName"` // 个人网站名
ExternalInformation string `gorm:"column:external_information;type:varchar(2048);" json:"externalInformation"` // 外部信息
CreatedAt time.Time `gorm:"column:created_at;index;autoCreateTime;<-:create;" json:"createdAt"` //
UpdatedAt time.Time `gorm:"column:updated_at;autoUpdateTime;" json:"updatedAt"`
DeletedAt *time.Time `gorm:"column:deleted_at;type:datetime;" json:"deletedAt"` //
}
func GetByEmail ¶ added in v0.0.3
GetByEmail 通过邮箱获取用户
func GetByUsername ¶
func (*Entity) GetExternalInformation ¶ added in v0.0.3
func (itself *Entity) GetExternalInformation() ExternalInformation
func (*Entity) GetShowName ¶ added in v0.0.3
func (*Entity) GetWebAvatarUrl ¶
func (*Entity) SetExternalInformation ¶ added in v0.0.3
func (itself *Entity) SetExternalInformation(info ExternalInformation)
func (*Entity) SetPassword ¶
type ExternalInformation ¶ added in v0.0.3
type ExternalInformation struct {
Github ExternalInformationItem `json:"github"`
Weibo ExternalInformationItem `json:"weibo"`
Bilibili ExternalInformationItem `json:"bilibili"`
Twitter ExternalInformationItem `json:"twitter"`
LinkedIn ExternalInformationItem `json:"linkedIn"`
Zhihu ExternalInformationItem `json:"zhihu"`
}
func (*ExternalInformation) Scan ¶ added in v0.0.3
func (itself *ExternalInformation) Scan(value any) error
type ExternalInformationItem ¶ added in v0.0.3
type ExternalInformationItem struct {
Link string `json:"link"`
}
Click to show internal directories.
Click to hide internal directories.