domain

package module
v0.0.0-...-ae2ac4e Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: MIT Imports: 9 Imported by: 0

README

domain-go

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateGameId

func GenerateGameId(year, gameNumber int) string

Types

type BoxScoreTeams

type BoxScoreTeams struct {
	Away Team `json:"away"`
	Home Team `json:"home"`
}

type Boxscore

type Boxscore struct {
	GameId       string                `json:"game_id"`
	DateUpdated  time.Time             `json:"date_updated"`
	SourceGameId string                `json:"source_game_id"`
	SourceName   string                `json:"source_name"`
	DateStart    time.Time             `json:"date_start"`
	Status       GameStatus            `json:"status"`
	Score        LineScores            `json:"score"`
	Attendance   int                   `json:"attendance"`
	Teams        BoxScoreTeams         `json:"teams"`
	PlayerStats  []BoxscorePlayerStats `json:"player_stats"`
	TeamStats    []struct {
		Away TeamStats `json:"away"`
		Home TeamStats `json:"home"`
	} `json:"team_stats"`
}

func CreateBoxScore

func CreateBoxScore(
	gameId string,
	sourceGameId string,
	sourceName string,
	dateStart time.Time,
	status GameStatus,
	score LineScores,
	teams BoxScoreTeams,
	playerStats []BoxscorePlayerStats,
	teamStats []struct {
		Away TeamStats `json:"away"`
		Home TeamStats `json:"home"`
	},
	attendance int,
) Boxscore

type BoxscorePlayerStats

type BoxscorePlayerStats struct {
	SourcePlayerId string      `json:"source_player_id"`
	Name           string      `json:"name"`
	Stats          PlayerStats `json:"stats"`
}

type GameStatus

type GameStatus struct {
	StatusId   GameStatusId `json:"status_id"`
	IsActive   bool         `json:"is_active"`
	HasStarted bool         `json:"has_started"`
	Quarter    int          `json:"quarter"`
	Minutes    int          `json:"minutes"`
	Seconds    int          `json:"seconds"`
	Down       int          `json:"down"`
	YardsToGo  int          `json:"yards_to_go"`
}

func CreateGameStatus

func CreateGameStatus(statusId GameStatusId) GameStatus

func CreateGameStatusInProgress

func CreateGameStatusInProgress(
	quarter int,
	minutes int,
	seconds int,
	down int,
	yardsToGo int,
) GameStatus

type GameStatusId

type GameStatusId string
const (
	GameStatusId_PreGame    GameStatusId = "pre_game"
	GameStatusId_InProgress GameStatusId = "in_progress"
	GameStatusId_Final      GameStatusId = "final"
	GameStatusId_Postponed  GameStatusId = "postponed"
	GameStatusId_Cancelled  GameStatusId = "cancelled"
)

type GameType

type GameType string
const (
	GameTypePreseason         GameType = "preseason"
	GameTypeRegular           GameType = "regular"
	GameTypeDivisionSemiFinal GameType = "division-semifinal"
	GameTypeDivisionFinal     GameType = "division-final"
	GameTypeGreyCup           GameType = "grey-cup"
)

type InjuryDetails

type InjuryDetails struct {
	StatusId    InjuryStatus `json:"status_id"`
	Text        string       `json:"text"`
	LastUpdated time.Time    `json:"last_updated"`
	Injury      string       `json:"injury"`
}

type InjuryStatus

type InjuryStatus string
const (
	InjuryStatusProbable     InjuryStatus = "probable"
	InjuryStatusQuestionable InjuryStatus = "questionable"
	InjuryStatusOut          InjuryStatus = "out"
	InjuryStatusInjuredSix   InjuryStatus = "six-game"
)

type LineScore

type LineScore struct {
	QuarterScores []int `json:"quarter_scores"`
	TotalScore    int   `json:"total_score"`
}

type LineScores

type LineScores struct {
	Away LineScore `json:"away"`
	Home LineScore `json:"home"`
}

type Player

type Player struct {
	PlayerId             string         `json:"player_id"`
	DateUpdated          time.Time      `json:"date_updated"`
	FirstName            string         `json:"first_name"`
	LastName             string         `json:"last_name"`
	FullName             string         `json:"full_name"`
	BirthDate            time.Time      `json:"birth_date"`
	BirthPlace           string         `json:"birth_place"`
	Height               string         `json:"height"`
	Weight               int            `json:"weight"`
	CanadianPlayer       bool           `json:"canadian_player"`
	Position             Position       `json:"position"`
	Team                 Team           `json:"team"`
	IsFreeAgent          bool           `json:"is_free_agent"`
	AlternateComputedIds []string       `json:"alternate_computed_ids"`
	Uniform              string         `json:"uniform"`
	School               string         `json:"school"`
	Seasons              []int          `json:"seasons"`
	InjuryStatus         *InjuryDetails `json:"injury_status"`
	SourceName           string         `json:"source_name"`
	SourceId             string         `json:"source_id"`
	LastUpdated          time.Time      `json:"last_updated"`
	Hash                 string         `json:"hash"`
}

func CreatePlayer

func CreatePlayer(
	firstName, lastName string,
	birthDate time.Time, birthplace string,
	height string, weight int,
	canadianPlayer bool,
	position Position,
	team Team,
	uniform string,
	school string,
	sourceName string,
	sourceId string,
	season int,
	injuryDetails *InjuryDetails,
) (Player, error)

func (*Player) UpdateHash

func (p *Player) UpdateHash() error

type PlayerStats

type PlayerStats struct {
	PassAttempts                         int `json:"pass_attempts"`
	PassCompletions                      int `json:"pass_completions"`
	PassNetYards                         int `json:"pass_net_yards"`
	PassLong                             int `json:"pass_long"`
	PassTouchdowns                       int `json:"pass_touchdowns"`
	PassLongTouchdowns                   int `json:"pass_long_touchdowns"`
	PassInterceptions                    int `json:"pass_interceptions"`
	RushAttempts                         int `json:"rush_attempts"`
	RushNetYards                         int `json:"rush_net_yards"`
	RushLong                             int `json:"rush_long"`
	RushTouchdowns                       int `json:"rush_touchdowns"`
	RushLongTouchdowns                   int `json:"rush_long_touchdowns"`
	ReceiveAttempts                      int `json:"receive_attempts"`
	ReceiveCaught                        int `json:"receive_caught"`
	ReceiveYards                         int `json:"receive_yards"`
	ReceiveLong                          int `json:"receive_long"`
	ReceiveTouchdowns                    int `json:"receive_touchdowns"`
	ReceiveLongTouchdowns                int `json:"receive_long_touchdowns"`
	ReceiveYardsAfterCatch               int `json:"receive_yards_after_catch"`
	Fumbles                              int `json:"fumbles"`
	FumblesLost                          int `json:"fumbles_lost"`
	Punts                                int `json:"punts"`
	PuntGrossYards                       int `json:"punt_gross_yards"`
	PuntNetYards                         int `json:"punt_net_yards"`
	PuntLong                             int `json:"punt_long"`
	PuntSingles                          int `json:"punt_singles"`
	PuntsBlocked                         int `json:"punts_blocked"`
	PuntsIn10                            int `json:"punts_in_10"`
	PuntsIn20                            int `json:"punts_in_20"`
	PuntsReturned                        int `json:"punts_returned"`
	KickReturns                          int `json:"kick_returns"`
	KickReturnsYards                     int `json:"kick_returns_yards"`
	KickReturnsTouchdowns                int `json:"kick_returns_touchdowns"`
	KickReturnsLong                      int `json:"kick_returns_long"`
	KickReturnsTouchdownsLong            int `json:"kick_returns_touchdowns_long"`
	FieldGoalAttempts                    int `json:"field_goal_attempts"`
	FieldGoalMade                        int `json:"field_goal_made"`
	FieldGoalMisses                      int `json:"field_goal_misses"`
	FieldGoalYards                       int `json:"field_goal_yards"`
	FieldGoalSingles                     int `json:"field_goal_singles"`
	FieldGoalLong                        int `json:"field_goal_long"`
	FieldGoalPoints                      int `json:"field_goal_points"`
	MissedFieldGoalReturns               int `json:"missed_field_goal_returns"`
	MissedFieldGoalReturnsYards          int `json:"missed_field_goal_returns_yards"`
	MissedFieldGoalReturnsTouchdowns     int `json:"missed_field_goal_returns_touchdowns"`
	MissedFieldGoalReturnsLong           int `json:"missed_field_goal_returns_long"`
	MissedFieldGoalReturnsTouchdownsLong int `json:"missed_field_goal_returns_touchdowns_long"`
	PuntReturns                          int `json:"punt_returns"`
	PuntReturnsYards                     int `json:"punt_returns_yards"`
	PuntReturnsTouchdowns                int `json:"punt_returns_touchdowns"`
	PuntReturnsLong                      int `json:"punt_returns_long"`
	PuntReturnsTouchdownsLong            int `json:"punt_returns_touchdowns_long"`
	Kicks                                int `json:"kicks"`
	KickYards                            int `json:"kick_yards"`
	KicksNetYards                        int `json:"kicks_net_yards"`
	KicksLong                            int `json:"kicks_long"`
	KicksSingles                         int `json:"kicks_singles"`
	KicksOutOfEndZone                    int `json:"kicks_out_of_end_zone"`
	KicksOnside                          int `json:"kicks_onside"`
	OnePointConvertsAttempts             int `json:"one_point_converts_attempts"`
	OnePointConvertsMade                 int `json:"one_point_converts_made"`
	TwoPointConvertsMade                 int `json:"two_point_converts_made"`
	TacklesTotal                         int `json:"tackles_total"`
	TacklesDefensive                     int `json:"tackles_defensive"`
	TacklesSpecialTeams                  int `json:"tackles_special_teams"`
	SacksQbMade                          int `json:"sacks_qb_made"`
	Interceptions                        int `json:"interceptions"`
	InterceptionYards                    int `json:"interceptions_yards"`
	InterceptionTouchdowns               int `json:"interception_touchdowns"`
	InterceptionLong                     int `json:"interception_long"`
	InterceptionTouchdownsLong           int `json:"interception_touchdowns_long"`
	FumblesForced                        int `json:"fumbles_forced"`
	FumblesRecovered                     int `json:"fumbles_recovered"`
	PassesKnockedDown                    int `json:"passes_knocked_down"`
}

type PlayerStub

type PlayerStub struct {
	PlayerId             string    `json:"player_id"`
	FirstName            string    `json:"first_name"`
	LastName             string    `json:"last_name"`
	BirthDate            time.Time `json:"birth_date"`
	IsFreeAgent          bool      `json:"is_free_agent"`
	LastUpdated          time.Time `json:"last_updated"`
	SourceName           string    `json:"source_name"`
	SourceId             string    `json:"source_id"`
	AlternateComputedIds []string  `json:"alternate_computed_ids"`
	Hash                 string    `json:"hash"`
}

type Position

type Position struct {
	Id   string `json:"id"`
	Name string `json:"name"`
}

func PositionFromId

func PositionFromId(id string) Position

type Schedule

type Schedule struct {
	Year        int            `json:"year"`
	DateUpdated time.Time      `json:"date_updated"`
	SourceName  string         `json:"source_name"`
	Games       []ScheduleGame `json:"games"`
}

func CreateSchedule

func CreateSchedule(year int, sourceName string) Schedule

type ScheduleGame

type ScheduleGame struct {
	GameId     string    `json:"game_id"`
	SourceName string    `json:"source_name"`
	SourceId   string    `json:"source_id"`
	DateStart  time.Time `json:"date_start"`
	GameNumber int       `json:"game_number"`
	WeekNumber int       `json:"week_number"`
	GameType   GameType  `json:"game_type"`
	Away       Team      `json:"away"`
	Home       Team      `json:"home"`
}

func CreateScheduleGame

func CreateScheduleGame(
	gameId string,
	dateStart time.Time,
	gameNumber int,
	weekNumber int,
	gameType GameType,
	away Team,
	home Team,
	sourceName string,
	sourceId string,
) ScheduleGame

type Score

type Score struct {
	Away int `json:"away"`
	Home int `json:"home"`
}

type Team

type Team struct {
	Location string `json:"location"`
	Name     string `json:"name"`
	Abbr     string `json:"abbr"`
}

func TeamBC

func TeamBC() Team

func TeamCGY

func TeamCGY() Team

func TeamEDM

func TeamEDM() Team

func TeamFreeAgents

func TeamFreeAgents() Team

func TeamFromAbbr

func TeamFromAbbr(abbr string) Team

func TeamHAM

func TeamHAM() Team

func TeamMTL

func TeamMTL() Team

func TeamOTT

func TeamOTT() Team

func TeamSSK

func TeamSSK() Team

func TeamTOR

func TeamTOR() Team

func TeamWPG

func TeamWPG() Team

func (Team) IsFreeAgent

func (t Team) IsFreeAgent() bool

type TeamStats

type TeamStats struct {
	TotalFirstDowns   int    `json:"total_first_downs"`
	Rushes            int    `json:"rushes"`
	RushYards         int    `json:"rush_yards"`
	RushTouchdowns    int    `json:"rush_touchdowns"`
	PassAttempts      int    `json:"pass_attempts"`
	PassCompletions   int    `json:"pass_completions"`
	PassGrossYards    int    `json:"pass_gross_yards"`
	PassTouchdowns    int    `json:"pass_touchdowns"`
	PassInterceptions int    `json:"pass_interceptions"`
	QbRating          string `json:"qb_rating"`
	SacksTaken        int    `json:"sacks_taken"`
	TotalGrossYards   int    `json:"total_gross_yards"`
	TimesFumbled      int    `json:"times_fumbled"`
	FumblesLost       int    `json:"fumbles_lost"`
	Turnovers         int    `json:"turnovers"`
	Penalties         int    `json:"penalties"`
	PenaltyYards      int    `json:"penalty_yards"`
}

Jump to

Keyboard shortcuts

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