model

package
v0.0.0-...-f5f779e Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2023 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Countries

func Countries(ts []Tournament) []string

Countries returns a list of tournament countries without duplicates

func Divisions

func Divisions(ts []Tournament) []string

Divisions returns a list of tournament divisions without duplicates

func Names

func Names(ts []Tournament) []string

Names returns a list of tournament names without duplicates

func ScoresFromRecord

func ScoresFromRecord(r []string, start int) []int8

func ScoresToRecord

func ScoresToRecord(scores []int8) []string

func Series

func Series(ts []Tournament) []string

Series returns a list of tournament series without duplicates

Types

type Game

type Game struct {
	Country  string
	Name     string
	Serie    string
	Division string
	Date     string
	Round    string
	Category string
	Teams    uint8
	Players  []string
	Sets     uint8
	Scores   []int8
}

Game represents tournament game and a csv line in the file

func NewFromRecord

func NewFromRecord(r []string) Game

NewFromRecord creates a new Game from a csv line in this case a []string. It is the opposite of ToRecord.

func (Game) Compare

func (g Game) Compare(other Game) int

Compare returns -1 if g is less than other, 0 if equals and +1 if greater than other The order is: Country, Name, Serie, Division, Category, Round, Date Players and Scores are not compared

func (Game) IsTournament

func (g Game) IsTournament(t Tournament) bool

IsTournament returns true if the game is part of the tournament

func (Game) ToRecord

func (g Game) ToRecord() []string

ToRecord returns a csv line in this case a []string. It is the opposite of NewFromRecord.

func (Game) Tournament

func (g Game) Tournament() Tournament

Tournament returns the tournament of the game

type Games

type Games []Game

Games is a collections of games and methods to manipulate the collection

func (*Games) Add

func (gs *Games) Add(g Game, sorted bool)

Add adds a game to the collection and sorts the collection if sorted is true

func (*Games) AddBulk

func (gs *Games) AddBulk(games []Game)

AddBulk adds a collection of games to the collection

func (Games) AddFromRecords

func (gs Games) AddFromRecords(records [][]string) Games

AddFromRecords reads csv records and creates a collection of games wihout duplicates

func (Games) Categories

func (gs Games) Categories() []string

Categories return a list without duplicates of all the categories in Games

func (Games) Dates

func (gs Games) Dates() []string

Dates returns a list without duplicates of all the available dates in Games

func (Games) Firstnames

func (gs Games) Firstnames() []string

Firstnames returns a list without duplicates of all the last names in Games

func (Games) Lastnames

func (gs Games) Lastnames() []string

Lastnames returns a list without duplicates of all the countries in Games

func (Games) Len

func (gs Games) Len() int

Len returns the number of games

func (Games) Less

func (gs Games) Less(i, j int) bool

Less returns true if game i is less than game j

func (Games) Rounds

func (gs Games) Rounds() []string

Rounds returns a list without duplicates of all the rounds in Games

func (Games) Swap

func (gs Games) Swap(i, j int)

Swap swaps two games

func (Games) Tournaments

func (gs Games) Tournaments() []Tournament

Tournaments returns a list of tournaments without duplicates

func (*Games) Update

func (gs *Games) Update(index int, g Game)

Update updates a game in the collection

type Tournament

type Tournament struct {
	Country  string
	Name     string
	Serie    string
	Division string
}

Tournament represents a tournament

Jump to

Keyboard shortcuts

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