match

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetMatchesBetween

func GetMatchesBetween(matches *[]Match, teamA string, teamB string) (*[]Match, error)

GetMatchesBetween returns the matches played between two teams.

func GetMatchesPlayedBy

func GetMatchesPlayedBy(matches *[]Match, teamName string) (*[]Match, error)

GetMatchesPlayedBy returns the matches played by a given team.

func GetMatchesPlayedByOpponents

func GetMatchesPlayedByOpponents(matches *[]Match, teamName string) (*[]Match, error)

GetMatchesPlayedByOpponents returns the matches played by the opponents of a given team. This excludes all matches played by the given team.

func GetMeetingCount

func GetMeetingCount(matches *[]Match, teamA string, teamB string) (int, error)

GetMeetingCount returns the number of meetings between two teams.

func GetOpponents

func GetOpponents(matches *[]Match, teamName string) ([]string, error)

GetOpponents returns the opponents for a given team.

Types

type Builder

type Builder struct {
	// contains filtered or unexported fields
}

func NewBuilder

func NewBuilder() *Builder

func (*Builder) BuildAwayName

func (m *Builder) BuildAwayName(awayName string) *Builder

func (*Builder) BuildAwayScore

func (m *Builder) BuildAwayScore(awayScore int) *Builder

func (*Builder) BuildDate

func (m *Builder) BuildDate(date time.Time) *Builder

func (*Builder) BuildHomeName

func (m *Builder) BuildHomeName(homeName string) *Builder

func (*Builder) BuildHomeScore

func (m *Builder) BuildHomeScore(homeScore int) *Builder

func (*Builder) GetInstance

func (m *Builder) GetInstance() *Match

type Factory

type Factory struct {
	// contains filtered or unexported fields
}

Factory is a factory for creating matches.

func NewFactory

func NewFactory(builder *Builder) *Factory

NewFactory creates a new match factory.

func (*Factory) Create

func (m *Factory) Create(date time.Time, homeName string, homeScore int, awayName string, awayScore int) *Match

Create creates a new match with the given parameters.

func (*Factory) CreateFromString

func (m *Factory) CreateFromString(input string) *Match

func (*Factory) CreateWithRandomDate

func (m *Factory) CreateWithRandomDate(homeName string, homeScore int, awayName string, awayScore int) *Match

type Match

type Match struct {
	Date time.Time
	Home Status
	Away Status
}

func NewMatch

func NewMatch() *Match

func NewMatchFromString

func NewMatchFromString(matchString string) *Match

func (*Match) Contains

func (m *Match) Contains(teamName string) bool

func (*Match) GetOpponent

func (m *Match) GetOpponent(teamName string) (string, error)

func (*Match) IsAwayTeam

func (m *Match) IsAwayTeam(teamName string) bool

func (*Match) IsDraw

func (m *Match) IsDraw() bool

func (*Match) IsHomeTeam

func (m *Match) IsHomeTeam(teamName string) bool

func (*Match) IsLoser

func (m *Match) IsLoser(teamName string) bool

func (*Match) IsWinner

func (m *Match) IsWinner(teamName string) bool

func (*Match) ToFullString

func (m *Match) ToFullString() string

func (*Match) ToString

func (m *Match) ToString() string

func (*Match) WinValue

func (m *Match) WinValue(teamName string) float64

type Status

type Status struct {
	Name  string
	Score int
}

Jump to

Keyboard shortcuts

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