Documentation ¶
Index ¶
- func GetColumns(t database.Table, exclude map[string]bool) []string
- func Migrate(db *gorm.DB) error
- func ResetUserEdge[T uuid.UUID | string](db *gorm.DB, userID T) error
- type User
- func GetUser(db *gorm.DB, columns ...string) (*User, error)
- func GetUserByAppleId(db *gorm.DB, appleID string, columns ...string) (*User, error)
- func GetUserByCustomId(db *gorm.DB, customId string, columns ...string) (*User, error)
- func GetUserByEmail(db *gorm.DB, email string, columns ...string) (*User, error)
- func GetUserByUserID[T uuid.UUID | string](db *gorm.DB, userID T, columns ...string) (*User, error)
- func GetUserByUsername(db *gorm.DB, username string, columns ...string) (*User, error)
- type UserDevice
- type UserEdge
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type User ¶
type User struct { database.ModelUUIDV1 Username string `json:"username" form:"username" gorm:"unique;not null;column:username;comment:账户名称;size:128;"` DisplayName string `json:"displayName" form:"displayName" gorm:"not null;column:display_name;comment:显示名称;size:255;default:'';"` AvatarUrl string `json:"avatarUrl" form:"avatarUrl" gorm:"not null;column:avatar_url;comment:头像地址;size:512;default:'';"` LangTag string `json:"langTag" form:"langTag" gorm:"not null;column:lang_tag;comment:语言;size:18;default:'';"` Location string `json:"location" form:"location" gorm:"not null;column:location;comment:;size:255;default:'';"` Timezone string `json:"timezone" form:"timezone" gorm:"not null;column:timezone;comment:时区;size:255;default:'';"` Metadata types.MapInterface `json:"metadata" form:"metadata" gorm:"not null;type:JSONB;column:metadata;comment:;default:'{}';"` Wallet types.MapInt64 `json:"wallet" form:"wallet" gorm:"not null;type:JSONB;index;column:wallet;comment:;default:'{}';"` Email *string `json:"email" form:"email" gorm:"unique;column:email;comment:;size:255;"` Password []byte `json:"password" form:"password" gorm:"column:password;check:length(password) < 32000;comment:密码;"` FacebookId *string `json:"facebookId" form:"facebookId" gorm:"unique;column:facebook_id;comment:;size:128;"` GoogleId *string `json:"googleId" form:"googleId" gorm:"unique;column:google_id;comment:;size:128;"` GamecenterId *string `json:"gamecenterId" form:"gamecenterId" gorm:"unique;column:gamecenter_id;comment:;size:128;"` StreamId *string `json:"streamId" form:"streamId" gorm:"unique;column:stream_id;comment:;size:128;"` CustomId *string `json:"customId" form:"customId" gorm:"unique;column:custom_id;comment:;size:128;"` EdgeCount int `json:"edgeCount" form:"edgeCount" gorm:"not null;column:edge_count;check:edge_count>=0;comment:;default:0;size:32;"` VerifyTime *pgtype.Timestamptz `json:"verifyTime" form:"verifyTime" gorm:"column:verify_time;comment:验证日期;"` DisableTime *pgtype.Timestamptz `json:"disableTime" form:"disableTime" gorm:"column:disable_time;comment:禁用;"` FacebookInstantGameId *string `json:"facebookInstantGameId" form:"facebookInstantGameId" gorm:"unique;column:facebook_instant_game_id;comment:;size:128;"` AppleId *string `json:"appleId" form:"appleId" gorm:"unique;column:apple_id;comment:;size:128;"` }
func GetUserByAppleId ¶
GetUserByAppleId Where apple_id = appleID
func GetUserByCustomId ¶
GetUserByCustomId Where custom_id = customId
func GetUserByEmail ¶
GetUserByEmail Where email = email
func GetUserByUserID ¶
GetUserByUserID Where id = userID
func GetUserByUsername ¶
GetUserByUsername Where username = username
type UserDevice ¶
type UserDevice struct { ID string `gorm:"primarykey;size:128;"` UserID uuid.UUID `json:"userId" form:"userId" gorm:"not null;column:user_id;comment:账户ID;"` User User `json:"user" form:"-" gorm:"foreignKey:UserID;constraint:OnDelete:CASCADE"` Preferences datatypes.JSON `json:"preferences" form:"preferences" gorm:"not null;column:preferences;comment:引用;default:'{}';"` }
func GetUserDevice ¶
func GetUserDevice(db *gorm.DB, columns ...string) (*UserDevice, error)
GetUserDevice Where
func GetUserDeviceByID ¶
func GetUserDeviceByID[T uuid.UUID | string](db *gorm.DB, deviceID T, columns ...string) (*UserDevice, error)
GetUserByUserID Where id = userID
func (UserDevice) TableName ¶
func (UserDevice) TableName() string
type UserEdge ¶
type UserEdge struct { SourceID uuid.UUID `gorm:"primarykey;not null;type:UUID;column:source_id;check:source_id <> '00000000-0000-0000-0000-000000000000'::uuid;"` DestinationID uuid.UUID `` /* 172-byte string literal not displayed */ Position int64 `json:"position" form:"position" gorm:"primarykey;not null;column:position;comment:;"` UpdatedAt time.Time `json:"updatedAt" form:"updatedAt" gorm:"not null;"` State int8 `json:"state" form:"state" gorm:"primarykey;not null;column:state;comment:;"` SourceUser User `json:"sourceUser" form:"-" gorm:"foreignKey:SourceID;constraint:OnDelete:CASCADE"` DestinationUser User `json:"destinationUser" form:"-" gorm:"foreignKey:DestinationID;constraint:OnDelete:CASCADE"` }
func GetUserEdge ¶
GetUserEdge Where
Click to show internal directories.
Click to hide internal directories.