Documentation
¶
Index ¶
- type AtBatXML
- type BaseballDB
- func (bdb *BaseballDB) Close() error
- func (bdb *BaseballDB) ConfirmGamedayMaster() error
- func (bdb *BaseballDB) ConfirmSavantMaster() error
- func (bdb *BaseballDB) ConnectToPostgres(prefix string) error
- func (bdb *BaseballDB) DropGamedayTable() error
- func (bdb *BaseballDB) DropSavantTable() error
- func (bdb *BaseballDB) LoadGamedayXML(f string) error
- func (bdb *BaseballDB) LoadSavantCSV(f string) error
- type GameXML
- type HalfInningXML
- type InningXML
- type PitchXML
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AtBatXML ¶
type AtBatXML struct {
PlayNumber int `xml:"num,attr"`
PlayGUID string `xml:"play_guid,attr"`
AwayTeamRuns int `xml:"away_team_runs,attr"`
HomeTeamRuns int `xml:"home_team_runs,attr"`
Balls int `xml:"b,attr"`
Strikes int `xml:"s,attr"`
Outs int `xml:"o,attr"`
BatterID int `xml:"batter,attr"`
BatterHeight string `xml:"b_height,attr"`
BatterSide string `xml:"stand,attr"`
PitcherID int `xml:"pitcher,attr"`
PitcherSide string `xml:"p_throws,attr"`
EnglishDesc string `xml:"des,attr"`
SpanishDesc string `xml:"des_es,attr"`
EnglishEventDesc string `xml:"event,attr"`
SpanishEventDesc string `xml:"event_es,attr"`
EventNumber int `xml:"event_num,attr"`
StartTFSZulu string `xml:"start_tfs_zulu,attr"`
EndTFSZulu string `xml:"end_tfs_zulu,attr"`
StartTFS string `xml:"start_tfs,attr"`
Pitches []PitchXML `xml:"pitch"`
}
AtBatXML represents an at bat
type BaseballDB ¶
type BaseballDB struct {
// contains filtered or unexported fields
}
BaseballDB holds data that allows interaction with a database
func (*BaseballDB) Close ¶
func (bdb *BaseballDB) Close() error
Close closes the connection to the database
func (*BaseballDB) ConfirmGamedayMaster ¶
func (bdb *BaseballDB) ConfirmGamedayMaster() error
ConfirmGamedayMaster makes sure that the table is present. If not, create it.
func (*BaseballDB) ConfirmSavantMaster ¶
func (bdb *BaseballDB) ConfirmSavantMaster() error
ConfirmSavantMaster makes sure that the table is present. If not, create it.
func (*BaseballDB) ConnectToPostgres ¶
func (bdb *BaseballDB) ConnectToPostgres(prefix string) error
ConnectToPostgres does something
func (*BaseballDB) DropGamedayTable ¶
func (bdb *BaseballDB) DropGamedayTable() error
DropGamedayTable gets rid of the table if it exists
func (*BaseballDB) DropSavantTable ¶
func (bdb *BaseballDB) DropSavantTable() error
DropSavantTable gets rid of the table if it exists
func (*BaseballDB) LoadGamedayXML ¶
func (bdb *BaseballDB) LoadGamedayXML(f string) error
LoadGamedayXML takes an XML file and bulk loads it into the database
func (*BaseballDB) LoadSavantCSV ¶
func (bdb *BaseballDB) LoadSavantCSV(f string) error
LoadSavantCSV takes a CSV file and bulk loads it into the database
type GameXML ¶
type GameXML struct {
AtBat int `xml:"atBat,attr"`
Deck int `xml:"deck,attr"`
Hole int `xml:"hole,attr"`
Ind string `xml:"ind,attr"`
Innings []InningXML `xml:"inning"`
}
GameXML is the highest level in the xml file
type HalfInningXML ¶
type HalfInningXML struct {
AtBats []AtBatXML `xml:"atbat"`
}
HalfInningXML represents a half inning
type InningXML ¶
type InningXML struct {
AwayTeam string `xml:"away_team,attr"`
HomeTeam string `xml:"home_team,attr"`
Next string `xml:"next,attr"`
Num int `xml:"num,attr"`
Top HalfInningXML `xml:"top"`
Bottom HalfInningXML `xml:"bottom"`
}
InningXML represents an inning
type PitchXML ¶
type PitchXML struct {
SVID string `xml:"sv_id,attr"`
TFS string `xml:"tfs,attr"`
TFSZulu string `xml:"tfs_zulu,attr"`
X string `xml:"x,attr"`
Y string `xml:"y,attr"`
X0 string `xml:"x0,attr"`
Y0 string `xml:"y0,attr"`
Z0 string `xml:"z0,attr"`
VX0 string `xml:"vx0,attr"`
VY0 string `xml:"vy0,attr"`
VZ0 string `xml:"vz0,attr"`
AX0 string `xml:"ax0,attr"`
AY0 string `xml:"ay0,attr"`
AZ0 string `xml:"az0,attr"`
PX string `xml:"px,attr"`
PZ string `xml:"pz,attr"`
PFXX string `xml:"pfx_x,attr"`
PFXZ string `xml:"pfx_z,attr"`
Type string `xml:"type,attr"`
TypeConfidence string `xml:"type_confidence"`
Zone string `xml:"zone,attr"`
SZTop string `xml:"sz_top,attr"`
SZBot string `xml:"sz_bot,attr"`
}
PitchXML represents a pitch