cfbdata

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2022 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DoRequest

func DoRequest(client *http.Client, key string, url string) ([]byte, error)

func DryRun

func DryRun(w io.Writer, c Collection) (int, error)

Types

type Collection

type Collection interface {
	RefByID(int64) (*fs.DocumentRef, bool)
	Ref(int) *fs.DocumentRef
	ID(int) int64
	Datum(int) interface{}
	FprintDatum(io.Writer, int) (int, error)
	Len() int
}

type Game

type Game struct {
	ID           int64     `json:"id"`
	Week         int       `json:"week"`
	StartTime    time.Time `json:"start_date"`
	StartTimeTBD bool      `json:"start_time_tbd"`
	NeutralSite  bool      `json:"neutral_site"`
	VenueID      int64     `json:"venue_id"`
	HomeID       int64     `json:"home_id"`
	AwayID       int64     `json:"away_id"`
	HomePoints   *int      `json:"home_points"`
	AwayPoints   *int      `json:"away_points"`
}

type GameCollection

type GameCollection struct {
	// contains filtered or unexported fields
}

GameCollection is a collection of games meeting the IterableWriter interface.

func GetAllGames

func GetAllGames(client *http.Client, key string, year int) (GameCollection, error)

func GetGames

func GetGames(client *http.Client, key string, year int, week int) (GameCollection, error)

func (*GameCollection) Append

func (gc *GameCollection) Append(g GameCollection)

func (GameCollection) Datum

func (gc GameCollection) Datum(i int) interface{}

func (GameCollection) FprintDatum

func (gc GameCollection) FprintDatum(w io.Writer, i int) (int, error)

func (GameCollection) GetWeek

func (gc GameCollection) GetWeek(week int) GameCollection

GetWeek splits the GameCollection into multiple GameCollections indexed by week.

func (GameCollection) ID

func (gc GameCollection) ID(i int) int64

func (GameCollection) Len

func (gc GameCollection) Len() int

Len gets the length of the collection

func (GameCollection) LinkRefs

func (GameCollection) Ref

func (gc GameCollection) Ref(i int) *fs.DocumentRef

func (GameCollection) RefByID

func (gc GameCollection) RefByID(id int64) (*fs.DocumentRef, bool)

func (GameCollection) Split

func (gc GameCollection) Split(include []int) (in GameCollection, out GameCollection)

Split splits a GameCollection into two based on idices to include or exclude from the results.

type LatLon

type LatLon struct {
	X float64 `json:"x"`
	Y float64 `json:"y"`
}

The CFBData calls latitude "X" and longitude "Y" for whatever reason

type Team

type Team struct {
	ID           int64    `json:"id"`
	School       string   `json:"school"`
	Mascot       *string  `json:"mascot"`
	Abbreviation *string  `json:"abbreviation"`
	AltName1     *string  `json:"alt_name1"`
	AltName2     *string  `json:"alt_name2"`
	AltName3     *string  `json:"alt_name3"`
	Color        *string  `json:"color"`
	AltColor     *string  `json:"alt_color"`
	Logos        []string `json:"logos"`
	Location     struct {
		VenueID *int64 `json:"venue_id"`
	}
}

type TeamCollection

type TeamCollection struct {
	// contains filtered or unexported fields
}

func GetTeams

func GetTeams(client *http.Client, key string) (TeamCollection, error)

func (TeamCollection) Datum

func (tc TeamCollection) Datum(i int) interface{}

func (TeamCollection) EliminateNonContenders

func (tc TeamCollection) EliminateNonContenders(gc GameCollection) TeamCollection

func (TeamCollection) FprintDatum

func (tc TeamCollection) FprintDatum(w io.Writer, i int) (int, error)

func (TeamCollection) ID

func (tc TeamCollection) ID(i int) int64

func (TeamCollection) Len

func (tc TeamCollection) Len() int

Len returns the number of weeks in the collection

func (TeamCollection) LinkRefs

func (tc TeamCollection) LinkRefs(vc VenueCollection, col *fs.CollectionRef) error

func (TeamCollection) Ref

func (tc TeamCollection) Ref(i int) *fs.DocumentRef

func (TeamCollection) RefByID

func (tc TeamCollection) RefByID(id int64) (*fs.DocumentRef, bool)

type TransactionIterator

type TransactionIterator struct {
	UpdateFcn func(*fs.Transaction, *fs.DocumentRef, interface{}) error
}

func (TransactionIterator) IterateTransaction

func (ti TransactionIterator) IterateTransaction(ctx context.Context, client *fs.Client, c Collection, n int) <-chan error

IterateTransaction iterates the collection by `n` elements at a time and uses the given function to write to Firestore

type Venue

type Venue struct {
	ID          int64  `json:"id"`
	Name        string `json:"name"`
	Capacity    int    `json:"capacity"`
	Grass       bool   `json:"grass"`
	City        string `json:"city"`
	State       string `json:"state"`
	Zip         string `json:"zip"`
	CountryCode string `json:"country_code"`
	Location    LatLon `json:"location"`
	Year        int    `json:"year"`
	Dome        bool   `json:"dome"`
	Timezone    string `json:"timezone"`
}

func MakeUnknownVenue

func MakeUnknownVenue() Venue

type VenueCollection

type VenueCollection struct {
	// contains filtered or unexported fields
}

func GetVenues

func GetVenues(client *http.Client, key string) (VenueCollection, error)

func (VenueCollection) Datum

func (vc VenueCollection) Datum(i int) interface{}

func (VenueCollection) FprintDatum

func (vc VenueCollection) FprintDatum(w io.Writer, i int) (int, error)

func (VenueCollection) ID

func (vc VenueCollection) ID(i int) int64

func (VenueCollection) Len

func (vc VenueCollection) Len() int

func (VenueCollection) LinkRefs

func (vc VenueCollection) LinkRefs(col *fs.CollectionRef) error

func (VenueCollection) Ref

func (vc VenueCollection) Ref(i int) *fs.DocumentRef

func (VenueCollection) RefByID

func (vc VenueCollection) RefByID(id int64) (*fs.DocumentRef, bool)

type Week

type Week struct {
	Season         string    `json:"season"`
	Number         int64     `json:"week"`
	FirstGameStart time.Time `json:"firstGameStart"`
	LastGameStart  time.Time `json:"lastGameStart"`
}

type WeekCollection

type WeekCollection struct {
	// contains filtered or unexported fields
}

func GetWeeks

func GetWeeks(client *http.Client, key string, season int, weekNumbers []int) (WeekCollection, error)

func (WeekCollection) Datum

func (wc WeekCollection) Datum(i int) interface{}

func (WeekCollection) FirstStartTime

func (wc WeekCollection) FirstStartTime() time.Time

func (WeekCollection) FprintDatum

func (wc WeekCollection) FprintDatum(w io.Writer, i int) (int, error)

func (WeekCollection) ID

func (wc WeekCollection) ID(i int) int64

func (WeekCollection) Len

func (wc WeekCollection) Len() int

Len returns the number of weeks in the collection

func (WeekCollection) LinkRefs

func (wc WeekCollection) LinkRefs(col *fs.CollectionRef) error

func (WeekCollection) Ref

func (wc WeekCollection) Ref(i int) *fs.DocumentRef

func (WeekCollection) RefByID

func (wc WeekCollection) RefByID(id int64) (*fs.DocumentRef, bool)

func (WeekCollection) Select

func (wc WeekCollection) Select(n int) (WeekCollection, bool)

func (WeekCollection) Split

func (wc WeekCollection) Split(include []int) (in WeekCollection, out WeekCollection)

Split splits a WeekCollection into two based on indices to include or exclude from the results.

Jump to

Keyboard shortcuts

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