spark-server/internal/module/user/entity/user.go
2026-09-29 16:37:36 +08:00

49 lines
1.0 KiB
Go

// Package entity holds user domain types. Persistence belongs in model.
package entity
import "time"
const StatusActive Status = 1
const StatusDisabled Status = 0
// Status is persisted as users.status. 1=active is the live account; 0=disabled.
type Status int
func (s Status) Valid() bool {
return s == StatusActive || s == StatusDisabled
}
const (
GenderUnknown Gender = 0
GenderMale Gender = 1
GenderFemale Gender = 2
)
// Gender is persisted as users.gender.
type Gender int
func (g Gender) Valid() bool {
return g == GenderUnknown || g == GenderMale || g == GenderFemale
}
func ValidGender(g int) bool {
return Gender(g).Valid()
}
// User is the account. ID is uid (Snowflake), never AUTO_INCREMENT.
type User struct {
ID int64
SparkID string
Nickname string
Avatar string
QRCode string
Birthday time.Time
Gender Gender
Status Status
SendMutedUntil time.Time
LastLoginAt time.Time
LastActiveAt time.Time
CreatedAt time.Time
UpdatedAt time.Time
}