dao

package
v2.0.0-...-32867ca Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 21, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetColumns

func GetColumns(t database.Table, exclude map[string]bool) []string

func Migrate

func Migrate(db *gorm.DB) error

func ResetUserEdge

func ResetUserEdge[T uuid.UUID | string](db *gorm.DB, userID T) error

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 GetUser

func GetUser(db *gorm.DB, columns ...string) (*User, error)

GetUser Where

func GetUserByAppleId

func GetUserByAppleId(db *gorm.DB, appleID string, columns ...string) (*User, error)

GetUserByAppleId Where apple_id = appleID

func GetUserByCustomId

func GetUserByCustomId(db *gorm.DB, customId string, columns ...string) (*User, error)

GetUserByCustomId Where custom_id = customId

func GetUserByEmail

func GetUserByEmail(db *gorm.DB, email string, columns ...string) (*User, error)

GetUserByEmail Where email = email

func GetUserByUserID

func GetUserByUserID[T uuid.UUID | string](db *gorm.DB, userID T, columns ...string) (*User, error)

GetUserByUserID Where id = userID

func GetUserByUsername

func GetUserByUsername(db *gorm.DB, username string, columns ...string) (*User, error)

GetUserByUsername Where username = username

func (*User) Disabled

func (user *User) Disabled() bool

func (*User) Migrate

func (user *User) Migrate(db *gorm.DB) error

func (User) TableName

func (User) TableName() string

func (*User) Verified

func (user *User) Verified() bool

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) Migrate

func (userDevice *UserDevice) Migrate(db *gorm.DB) error

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

func GetUserEdge(db *gorm.DB, columns ...string) (*UserEdge, error)

GetUserEdge Where

func (*UserEdge) Migrate

func (userEdge *UserEdge) Migrate(db *gorm.DB) error

func (UserEdge) TableName

func (UserEdge) TableName() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL