pggameday

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

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

Go to latest
Published: Oct 13, 2015 License: MIT Imports: 6 Imported by: 0

README

pggameday

A utility for saving MLB Gameday data to Postgres.

Prerequisites:

  • Working go installation
  • PostgreSQL running locally, with a user and database named 'go-gameday'
  • pq (go PostgreSQL driver; run 'go get github.com/lib/pq')

To build and run from the command line

In your go workspace, under a directory github.com/ecopony/

git clone git@github.com:ecopony/pggameday.git
cd pggameday
go build pg/pgmlbgd.go

To create the database tables:

./pgmlbgd create-tables

To import all pitches for a team for a given year:

./pgmlbgd import-pitches-for-team-and-year sea 2014

To import all pitches for a given year:

./pgmlbgd import-pitches-for-year 2014

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateGameStatsTable

func CreateGameStatsTable()

CreateGameStatsTable creates the hits table and associated indexes. This will drop things if they already exist, causing data loss.

func CreateHitsTable

func CreateHitsTable()

CreateHitsTable creates the hits table and associated indexes. This will drop things if they already exist, causing data loss.

func CreatePitchesTable

func CreatePitchesTable()

CreatePitchesTable creates the pitches table and associated indexes. This will drop things if they already exist, causing data loss.

func CreatePlayersTable

func CreatePlayersTable()

CreatePlayersTable creates the players table and associated indexes. This will drop things if they already exist, causing data loss.

func CreateTables

func CreateTables()

CreateTables creates the database tables used by the importer. For now it's just the pitches table. This will drop tables if they already exist.

func ImportGameStatsForTeamAndYears

func ImportGameStatsForTeamAndYears(teamCode string, years []int)

ImportGameStatsForTeamAndYears saves game stats fields for a team and season in the game_stats table.

func ImportHitsForTeamAndYears

func ImportHitsForTeamAndYears(teamCode string, years []int)

ImportHitsForTeamAndYears saves all hit data fields for a team and season in the hits table.

func ImportPitchesForTeamAndYears

func ImportPitchesForTeamAndYears(teamCode string, years []int)

ImportPitchesForTeamAndYears saves all pitch data fields for a team and season.

func ImportPlayersForTeamAndYears

func ImportPlayersForTeamAndYears(teamCode string, years []int)

ImportPlayersForTeamAndYears saves all player data fields for a team and season.

Types

type GameStats

type GameStats struct {
	StatsTeamCode   string
	Game            *gamedayapi.Game
	StatsTeamWon    bool
	ExtraInningLoss bool
	WalkOffLoss     bool
}

func GameStatsFor

func GameStatsFor(statsTeamCode string, game *gamedayapi.Game) *GameStats

func (*GameStats) IsStatsTeamHomeTeam

func (gameStats *GameStats) IsStatsTeamHomeTeam() bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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