database

package
v0.0.0-...-224700b Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DB *gorm.DB

Functions

func ConDB

func ConDB()

Types

type HistoryModel

type HistoryModel struct {
	gorm.Model
	Winner       string          `json:"winner" gorm:"type:char(1)"`
	InviteID     uint            `json:"invite_id"`
	InvitationFK InvitationModel `gorm:"foreignKey:InviteID"`
	HomeID       uint            `json:"home_id"`
	HomeFK       UserModel       `gorm:"foreignKey:HomeID"`
	AwayID       uint            `json:"away_id"`
	AwayFK       UserModel       `gorm:"foreignKey:AwayID"`
}

func (HistoryModel) TableName

func (HistoryModel) TableName() string

type InvitationModel

type InvitationModel struct {
	gorm.Model
	StartTimeStamp   time.Time `json:"start_timestamp" gorm:"type:timestamptz"`
	ExpiredTimeStamp time.Time `json:"expired_timestamp" gorm:"type:timestamptz"`
	IsAccept         string    `json:"is_accept" gorm:"type:char(1)"`
	HomeID           uint      `json:"home_id"`
	HomeFK           UserModel `gorm:"foreignKey:HomeID"`
	AwayID           uint      `json:"away_id"`
	AwayFK           UserModel `gorm:"foreignKey:AwayID"`
	Token            string    `json:"token" gorm:"column:token; index"`
}

func (InvitationModel) TableName

func (InvitationModel) TableName() string

type Tabler

type Tabler interface {
	TableName() string
}

type TicTacToeModel

type TicTacToeModel struct {
	InviteID          int             `json:"invite_id" gorm:"column:invite_id; index"`
	InvitationModelFK InvitationModel `gorm:"foreignKey:InviteID"`
	Token             string          `json:"token" gorm:"column:token; index"`
	IsEnd             string          `json:"is_end" gorm:"column:is_end; type:char(1)"`
	ExpiredAt         time.Time       `json:"expired_at" gorm:"column:expired_at; type:timestamptz"`
	Board             []int           `json:"board" gorm:"column:board; type:integer[]"`
	CreatedAt         time.Time       `json:"created_at" gorm:"column:created_at; type:timestamptz"`
	UpdatedAt         time.Time       `json:"updated_at" gorm:"column:updated_at; type:timestamptz"`
	DeletedAt         time.Time       `json:"deleted_at" gorm:"column:deleted_at; type:timestamptz"`
	HomeID            int             `json:"home_id"`
	HomeModelFK       UserModel       `gorm:"foreignKey:HomeID"`
	AwayID            int             `json:"home_id"`
	AwayModelFK       UserModel       `gorm:"foreignKey:AwayID"`
}

func (TicTacToeModel) TableName

func (TicTacToeModel) TableName() string

type UserModel

type UserModel struct {
	gorm.Model
	Username string `json:"username" gorm:"type:varchar(50); uniqueIndex;"`
	Win      uint   `json:"wins" gorm:"default:0"`
	Lose     uint   `json:"loses" gorm:"default:0"`
	Draw     uint   `json:"draws" gorm:"default:0"`
	Total    uint   `json:"total" gorm:"default:0"`
	Mail     string `json:"mail" gorm:"uniqueIndex"`
	Pwd      string `json:"pwd" gorm:"password"`
}

func (UserModel) TableName

func (UserModel) TableName() string

type UserTokenModel

type UserTokenModel struct {
	UserID    int       `json:"user_id"`
	UserFK    UserModel `gorm:"foreignKey:UserID"`
	Token     string    `json:"token" gorm:"column:token; index; type:char(32)"`
	OnUsed    string    `json:"on_used" gorm:"column:on_used; type:char(1);"`
	ExpiredAt time.Time `json:"expired_at" gorm:"column:expired_at; type:timestamptz;"`
}

func (UserTokenModel) TableName

func (UserTokenModel) TableName() string

Jump to

Keyboard shortcuts

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