Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( //ErrIterate informs if iteration errors ErrIterate = errors.New("can't iterate over the colection documents") //ErrExtractDataToStruct informs if unable to extract firestore data to struct ErrExtractDataToStruct = errors.New("can't extract the data into a struct with DataTo") )
Functions ¶
This section is empty.
Types ¶
type Middleware ¶
type Middleware func(StatsService) StatsService
Middleware describes a service (as opposed to endpoint) middleware.
func LoggingMiddleware ¶
func LoggingMiddleware(logger log.Logger) Middleware
LoggingMiddleware takes a logger as a dependency and returns a ServiceMiddleware.
type Player ¶
type Player struct {
Name string `firestore:"player"`
Team string `firestore:"team"`
Nationality string `firestore:"nationality"`
Position string `firestore:"position"`
Appearences int32 `firestore:"appearences"`
Goals int32 `firestore:"goals"`
Assists int32 `firestore:"assists"`
Passes int32 `firestore:"passes"`
Interceptions int32 `firestore:"Interceptions"`
Tackles int32 `firestore:"Tackles"`
Fouls int32 `firestore:"Fouls"`
}
Player struct holds player data
type StatsService ¶
type StatsService interface {
ListTable(ctx context.Context, league string) ([]Table, error)
ListTeamPlayers(ctx context.Context, teamName string) ([]Player, error)
ListPositionPlayers(ctx context.Context, position string) ([]Player, error)
}
StatsService describe the Stats service
func NewBasicService ¶
func NewBasicService(client *firestore.Client) StatsService
NewBasicService returns a naive, stateless implementation of StatsService.
func NewStatsService ¶
func NewStatsService(client *firestore.Client, logger log.Logger) StatsService
NewStatsService returns a basic StatsService with all of the expected middlewares wired in.
type Table ¶
type Table struct {
TeamName string `firestore:"Name"`
TeamPlayed int32 `firestore:"Played"`
TeamWon int32 `firestore:"Won"`
TeamDrawn int32 `firestore:"Drawn"`
TeamLost int32 `firestore:"Lost"`
TeamGF int32 `firestore:"GF"`
TeamGA int32 `firestore:"GA"`
TeamGD int32 `firestore:"GD"`
TeamPoints int32 `firestore:"Points"`
TeamCapital int32 `firestore:"Capital"`
}
Table struct holds League table data
Click to show internal directories.
Click to hide internal directories.