matches

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: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MatchDataStore

type MatchDataStore interface {
	GetMatches(string, int) []model.Match
	GetTeamSeason(string, string) model.TeamSeason
	UpdateObject(interface{})
	GetTeams() []model.Team
	SaveObject(interface{})
}

MatchDataStore interface

type MatchService

type MatchService interface {
	GetWeeksMatches(string, int) []model.Match
	SimMatchWeek(string, int)
	ScheduleSeason(string) []model.Match
}

MatchService interface for match logic

type MatchServiceImp

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

MatchServiceImp implements MatchService

func NewMatchService

func NewMatchService(dataStore MatchDataStore) MatchServiceImp

NewMatchService returns a MatchService with provided data store

func (MatchServiceImp) GetWeeksMatches

func (m MatchServiceImp) GetWeeksMatches(season string,
	week int) []model.Match

GetWeeksMatches service

func (MatchServiceImp) ScheduleSeason

func (m MatchServiceImp) ScheduleSeason(seasonName string) []model.Match

ScheduleSeason schedules a new season from an slice of teams

func (MatchServiceImp) SimMatchWeek

func (m MatchServiceImp) SimMatchWeek(season string, matchWeek int)

SimMatchWeek takes a season and a matchWeek and simulates all the matches that week

1. Pulls the matches from that week from the DB 2. Runs the game simulator to get the game score from the 2 teams 3. Updates the match with the result in the db 4. Updates the teams records and goals

type SchedulerDataStore

type SchedulerDataStore interface {
	GetTeams() []model.Team
	SaveObject(interface{})
}

SchedulerDataStore interface

type Simulator

type Simulator interface {
	Sim(*model.TeamSeason, *model.TeamSeason, *model.Match)
}

Simulator describes a simulator

Jump to

Keyboard shortcuts

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