model

package
v0.0.0-...-eff0ea3 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2018 License: MIT Imports: 0 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Match

type Match struct {
	ID            int
	HomeTeam      string
	AwayTeam      string
	HomeTeamGoals int
	AwayTeamGoals int
	MatchWeek     int
	Season        string
	Played        bool
	// contains filtered or unexported fields
}

Match data model

func NewMatch

func NewMatch(home, away, season string, week int) Match

NewMatch constructor

type PointsSorter

type PointsSorter []*TeamSeason

PointsSorter sorts an array of teams by total points

func (PointsSorter) Len

func (a PointsSorter) Len() int

func (PointsSorter) Less

func (a PointsSorter) Less(i, j int) bool

func (PointsSorter) Swap

func (a PointsSorter) Swap(i, j int)

type SimWeekRequest

type SimWeekRequest struct {
	SeasonName string
	Week       int
	Action     string
}

SimWeekRequest is a json request to sim all matches in a season/week

type Team

type Team struct {
	Abv  string `sql:",pk"`
	Name string
}

Team data model

type TeamSeason

type TeamSeason struct {
	ID           int
	Season       string
	GamesWon     int
	GamesLost    int
	GamesDrawn   int
	GoalsScored  int
	GoalsAllowed int
	TeamID       string
	// contains filtered or unexported fields
}

TeamSeason for Instert

func (*TeamSeason) AddResult

func (t *TeamSeason) AddResult(goalsFor, goalsAgainst int)

AddResult updates a teams record and Goals

func (TeamSeason) TotalPoints

func (t TeamSeason) TotalPoints() int

TotalPoints converts record to league points

type TeamSeasonJoin

type TeamSeasonJoin struct {
	Team
	TeamSeason
}

TeamSeasonJoin data model

func NewTeamSeasonJoin

func NewTeamSeasonJoin(id int, abv, name, season string) TeamSeasonJoin

NewTeamSeasonJoin returns a new team season with team variables

Jump to

Keyboard shortcuts

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