Documentation
¶
Index ¶
- func Create(entity *EntityComplete) error
- func ExistEmail(email string) bool
- func ExistUsername(username string) bool
- func GetCount() int64
- func GetMapByIds(userIds []uint64) map[uint64]*EntityComplete
- func GetMaxId() uint64
- func GetMonthCount() int64
- func IncrementPrestige(addNumber int64, userId uint64) int64
- func Page(q PageQuery) struct{ ... }
- func RandAvatarUrl() string
- func Save(entity *EntityComplete) error
- type EntityComplete
- func All() (entities []*EntityComplete)
- func Get(id any) (entity EntityComplete, err error)
- func GetByEmail(email string) (entity EntityComplete, err error)
- func GetByIds(userIds []uint64) (entities []*EntityComplete)
- func GetByUsername(username string) (entities *EntityComplete)
- func MakeUser(name string, password string, email string) *EntityComplete
- func QueryById(startId uint64, limit int) (entities []*EntityComplete)
- func Verify(usernameOrEmail string, password string) (*EntityComplete, error)
- type ExternalInformation
- type ExternalInformationItem
- type PageQuery
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Create ¶
func Create(entity *EntityComplete) error
func GetMapByIds ¶
func GetMapByIds(userIds []uint64) map[uint64]*EntityComplete
func GetMonthCount ¶ added in v0.0.3
func GetMonthCount() int64
func IncrementPrestige ¶
func Page ¶
func Page(q PageQuery) struct { Page int PageSize int Total int64 Data []EntityComplete }
func RandAvatarUrl ¶ added in v0.0.6
func RandAvatarUrl() string
func Save ¶
func Save(entity *EntityComplete) error
Types ¶
type EntityComplete ¶ added in v0.0.7
type EntityComplete struct {
// base
Id uint64 `gorm:"primaryKey;column:id;autoIncrement;not null;" json:"id"` //
Username string `gorm:"column:username;index;type:varchar(64);not null;default:'';" json:"username"` //
Email string `gorm:"column:email;index;type:varchar(128);not null;default:'';" json:"email"` //
Password string `gorm:"column:password;type:varchar(128);not null;default:'';" json:"password"` //
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"` // 激活时间
// info
Nickname string `gorm:"column:nickname;type:varchar(64);not null;default:'';" json:"nickname"` //
RoleId uint64 `gorm:"column:role_id;type:bigint unsigned;not null;default:0;" json:"roleId"` //
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);not null;default:'';" json:"bio"` // 个人简介
Signature string `gorm:"column:signature;type:varchar(255);not null;default:'';" json:"signature"` // 署名
WebsiteName string `gorm:"column:website_name;type:varchar(64);not null;default:'';" json:"websiteName"` // 个人网站名
Website string `gorm:"column:website;type:varchar(255);not null;default:'';" json:"website"` // 个人网站
ExternalInformation ExternalInformation `gorm:"column:external_information;type:varchar(2048);default:'{}';serializer:json" json:"externalInformation"` // 外部信息
// status
CreatedAt time.Time `gorm:"column:created_at;index;autoCreateTime;<-:create;" json:"createdAt"` //
UpdatedAt time.Time `gorm:"column:updated_at;autoUpdateTime;" json:"updatedAt"`
DeletedAt gorm.DeletedAt //
}
func All ¶
func All() (entities []*EntityComplete)
func Get ¶
func Get(id any) (entity EntityComplete, err error)
func GetByEmail ¶ added in v0.0.3
func GetByEmail(email string) (entity EntityComplete, err error)
GetByEmail 通过邮箱获取用户
func GetByIds ¶
func GetByIds(userIds []uint64) (entities []*EntityComplete)
func GetByUsername ¶
func GetByUsername(username string) (entities *EntityComplete)
func QueryById ¶ added in v0.0.3
func QueryById(startId uint64, limit int) (entities []*EntityComplete)
func (*EntityComplete) Activate ¶ added in v0.0.7
func (itself *EntityComplete) Activate() error
func (*EntityComplete) GetWebAvatarUrl ¶ added in v0.0.7
func (itself *EntityComplete) GetWebAvatarUrl() string
func (*EntityComplete) SetPassword ¶ added in v0.0.7
func (itself *EntityComplete) SetPassword(password string) *EntityComplete
func (*EntityComplete) TableName ¶ added in v0.0.7
func (itself *EntityComplete) TableName() string
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"`
}
type ExternalInformationItem ¶ added in v0.0.3
type ExternalInformationItem struct {
Link string `json:"link"`
}
Click to show internal directories.
Click to hide internal directories.