models

package
v2.0.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2017 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetPoint

func GetPoint(x, y int) int

func InitDB

func InitDB() *gorm.DB

Types

type Match

type Match struct {
	gorm.Model
	Tournament   Tournament `gorm:"ForeignKey:TournamentID"`
	TournamentID uint
	Team1        Team `gorm:"ForeignKey:Team1ID"`
	Team1ID      uint
	Team2        Team `gorm:"ForeignKey:Team2ID"`
	Team2ID      uint
	Team1Score   int `sql:"DEFAULT:-1"`
	Team2Score   int `sql:"DEFAULT:-1"`
}

func (*Match) GetMatchInfo

func (match *Match) GetMatchInfo(newMatch Match)

type Member

type Member struct {
	gorm.Model
	Username string `gorm:"not null;unique" json:"username"`
}

type Score

type Score struct {
	Team1Score int `json:"score_team_1"`
	Team2Score int `json:"score_team_2"`
}

type Team

type Team struct {
	gorm.Model
	Tournament    Tournament `gorm:"ForeignKey:TournamentID"`
	TournamentID  uint
	Member1       Member `gorm:"ForeignKey:Member1ID"`
	Member1ID     uint
	Member2       Member `gorm:"ForeignKey:Member2ID"`
	Member2ID     uint
	PlayedMatches int
	GF            int
	GA            int
	GD            int
	Points        int
}

func (Team) UpdateTeamScore

func (team Team) UpdateTeamScore()

type TeamRequest

type TeamRequest struct {
	Teams []struct {
		Member1_id int `json:"member1_id"`
		Member2_id int `json:"member2_id"`
	} `json:"teams"`
}

type Tournament

type Tournament struct {
	gorm.Model

	Matches []Match `gorm:"ForeignKey:TournamentID"`
	Teams   []Team  `gorm:"ForeignKey:TournamentID"`
}

func (*Tournament) ShuffleMatch

func (tour *Tournament) ShuffleMatch()

Jump to

Keyboard shortcuts

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