Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DB ¶
type DB struct { DB *squalor.DB Games *squalor.Model Officials *squalor.Model Officiated *squalor.Model Players *squalor.Model Stats *squalor.Model PlayerGameStats *squalor.Model TeamGameStats *squalor.Model Teams *squalor.Model Events *squalor.Model }
DB encapsulates a connection to an NBAGame database.
func New ¶
New creates a new connection to an NBAGame database. It takes an environment that should be defined in the goose dbconf.yml file.
func WithDSN ¶
WithDSN creates a new connection to an NBAGame database, using the specified MySQL driver and DSN.
func (*DB) RecordGameEvent ¶
func (*DB) RecordPlayerGameStats ¶
func (db *DB) RecordPlayerGameStats(playerID int, gameID data.GameID, teamID int, stats *data.Stats) error
RecordPlayerGameStats records stats about a player's performance in an individual game. It performs a lookup first to ensure that the player's stats haven't already been synced. If they have, it will update them.
func (*DB) RecordTeamGameStats ¶
RecordTeamGameStats records stats about a team's performance in an individual game. It performs a lookup first to ensure that the team's stats haven't already been synced. If they have, it will update them.
type Event ¶
type Event struct { GameID data.GameID `db:"game_id"` Seq int `db:"seq"` EventType string `db:"event_type"` Period int `db:"period"` ScoreHome int `db:"score_home"` ScoreVisitor int `db:"score_visitor"` PeriodTime int `db:"period_time"` WallClock string `db:"wall_clock"` Player1ID *int `db:"player1_id"` Player2ID *int `db:"player2_id"` Player3ID *int `db:"player3_id"` HomeDescription *string `db:"home_description"` NeutralDescription *string `db:"neutral_description"` VisitorDescription *string `db:"visitor_description"` }
Event is a db model for the data.Event type.