models

package
v0.0.0-...-cd96442 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsNil

func IsNil(m any) bool

func TrimFields

func TrimFields(endpoint string, items []interface{}) []map[string]any

Types

type Country

type Country struct {
	gorm.Model `json:"-"`

	ID       int    `gorm:"primarykey" json:"id" uri:"id"`
	Name     string `gorm:"unique" json:"name" uri:"name"`
	Group    string `json:"group" uri:"group"`
	FifaCode string `gorm:"unique" json:"fifa_code" uri:"code"`
}

type Match

type Match struct {
	gorm.Model `json:"-"`

	ID     int  `gorm:"primarykey" json:"id"`
	Day    int  `gorm:"default:0"  json:"match_day" uri:"day"`
	Played bool `gorm:"default:false" json:"played"`

	AID      int     `json:"-"`
	BID      int     `json:"-"`
	ACountry Country `gorm:"foreignKey:AID" json:"country_a"`
	BCountry Country `gorm:"foreignKey:BID" json:"country_b"`

	Stage Stage `json:"-"`

	When     time.Time `json:"when"`
	Assigned bool      `gorm:"default:false" json:"-"`
}

type MatchResult

type MatchResult struct {
	gorm.Model `json:"-"`

	ID      int `gorm:"primarykey" json:"id"`
	MatchID int

	Yellow       uint
	Red          uint
	GoalsFor     uint
	GoalsAgainst uint
	Points       uint
}

type Player

type Player struct {
	gorm.Model `json:"-"`

	ID        int     `gorm:"primarykey" json:"id" uri:"id"`
	CountryID int     `json:"-"`
	Country   Country `json:"country"`

	Name     string `json:"name" uri:"name"`
	Position string `json:"position"`
	Number   int    `gorm:"default:-1" json:"number"`

	Goals  uint `gorm:"default:0" json:"goals" `
	Yellow uint `gorm:"default:0" json:"yellows"`
	Red    uint `gorm:"default:0" json:"reds"`
	Saves  int  `gorm:"default:-1" json:"saves"`
}

type Stage

type Stage uint
const (
	GROUP Stage = iota
	ROUND_OF_SIXTEEN
	QUARTERFINALS
	SEMIFINALS
	THIRD_PLACE
	FINAL
)

Jump to

Keyboard shortcuts

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