game

package
v0.0.0-...-5888283 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GameScheduledUpdate

type GameScheduledUpdate struct {
	NBAGameID       string
	NBAHomeTeamID   sql.NullInt64
	NBAAwayTeamID   sql.NullInt64
	HomeTeamPoints  sql.NullInt64
	AwayTeamPoints  sql.NullInt64
	GameStatusName  string
	NBAArenaName    string
	SeasonStartYear int
	SeasonStageName string
	StartTime       time.Time
}

type GameStatus

type GameStatus string
const (
	GameStatusCompleted GameStatus = "completed"
	GameStatusScheduled GameStatus = "scheduled"
	GameStatusStarted   GameStatus = "started"
)

type GameSummaryUpdate

type GameSummaryUpdate struct {
	NBAGameID                       string
	NBAHomeTeamID                   int
	NBAAwayTeamID                   int
	HomeTeamPoints                  sql.NullInt64
	AwayTeamPoints                  sql.NullInt64
	GameStatusName                  string
	Attendance                      int
	SeasonStartYear                 string
	SeasonStageName                 string
	Period                          int
	PeriodTimeRemainingTenthSeconds int
	DurationSeconds                 sql.NullInt64
	StartTime                       time.Time
	EndTime                         sql.NullTime
}

type GameUpdate

type GameUpdate struct {
	NBAGameID                       string
	NBAHomeTeamID                   int
	NBAAwayTeamID                   int
	HomeTeamPoints                  sql.NullInt64
	AwayTeamPoints                  sql.NullInt64
	GameStatusName                  string
	NBAArenaID                      int
	Attendance                      int
	SeasonStartYear                 int
	SeasonStageName                 string
	Sellout                         bool
	Period                          int
	PeriodTimeRemainingTenthSeconds int
	DurationSeconds                 int
	RegulationPeriods               int
	StartTime                       time.Time
	EndTime                         sql.NullTime
}

type Handler

type Handler interface {
	Routes() chi.Router
	List(w http.ResponseWriter, r *http.Request)
	UpdateGames(w http.ResponseWriter, r *http.Request)
}

func NewHandler

func NewHandler(logger *slog.Logger, gameService Service) Handler

type Service

type Service interface {
	GetGameWithID(ctx context.Context, id string) (api.Game, error)
	List(ctx context.Context) ([]api.Game, error)
	GetGameWithNBAID(ctx context.Context, nbaID string) (api.Game, error)
	UpdateGame(ctx context.Context, logger *slog.Logger, gameID string, seasonStartYear int) (api.Game, error)
	UpdateSeasonGames(ctx context.Context, logger *slog.Logger, seasonStartYear int) ([]api.Game, error)
}

func NewService

func NewService(
	gameStore Store,
	arenaService arena.Service,
	gameRefereeService game_referee.Service,
	leagueService league.Service,
	playByPlayService playbyplay.Service,
	refereeService referee.Service,
	seasonService season.Service,
	teamService team.Service,
	teamGameStatsService team_game_stats.Service,
	nbaClient nba.Client,
	r2Client cloudflare.Client,
) Service

type Store

type Store interface {
	List(ctx context.Context) ([]api.Game, error)
	GetGameWithID(ctx context.Context, id string) (api.Game, error)
	GetGamesWithIDs(ctx context.Context, ids []string) ([]api.Game, error)
	GetGameWithNBAID(ctx context.Context, id string) (api.Game, error)
	UpdateGamesSummary(ctx context.Context, gameUpdates []GameSummaryUpdate) ([]api.Game, error)
	UpdateGames(ctx context.Context, gameUpdates []GameUpdate) ([]api.Game, error)
	UpdateScheduledGames(ctx context.Context, gameUpdates []GameScheduledUpdate) ([]api.Game, error)
}

Jump to

Keyboard shortcuts

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