Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( //ErrTeamNotFound unable to find the requested team ErrTeamNotFound = errors.New("team not found") //ErrPLayerNotFound unable to find requested player ErrPLayerNotFound = errors.New("player not found") //ErrDisplayTable unable to disply table ErrDisplayTable = errors.New("unable to display table") //ErrDisplayPlayers unable to disply table ErrDisplayPlayers = errors.New("unable to display players") //ErrPosition wrong position request ErrPosition = errors.New("wrong position, select either Defender, Forward or Midfielder") )
Functions ¶
This section is empty.
Types ¶
type Middleware ¶
type Middleware func(SiteService) SiteService
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 `json:"name"` Team string `json:"team"` Nationality string `json:"nationality"` Position string `json:"position"` Appearences int32 `json:"appearences"` Goals int32 `json:"goals"` Assists int32 `json:"assists"` Passes int32 `json:"passes"` Interceptions int32 `json:"interceptions"` Tackles int32 `json:"tackles"` Fouls int32 `json:"fouls"` Price int32 `json:"price"` }
Player struct holds player data
type SiteService ¶
type SiteService interface { GetTable(ctx context.Context, league string) ([]*Table, error) GetTeamBestPlayers(ctx context.Context, teamName string) ([]*Player, error) GetPositionBestPlayers(ctx context.Context, position string) ([]*Player, error) CreatePlayer(ctx context.Context, newplayer *Player) (string, error) DeletePlayer(ctx context.Context, delplayer string, teamName string) (string, error) TransferPlayer(ctx context.Context, playerName string, teamFrom string, TeamTO string) (string, error) }
SiteService describe the Stats service
func NewBasicService ¶
func NewBasicService(conn1 *grpc.ClientConn, conn2 *grpc.ClientConn, conn3 *grpc.ClientConn) SiteService
NewBasicService returns a naive, stateless implementation of StatsService.
func NewSiteService ¶
func NewSiteService(logger log.Logger, conn1 *grpc.ClientConn, conn2 *grpc.ClientConn, conn3 *grpc.ClientConn) SiteService
NewSiteService returns a basic StatsService with all of the expected middlewares wired in.
type Table ¶
type Table struct { TeamName string `json:"teamName"` TeamPlayed int32 `json:"teamPlayed"` TeamWon int32 `json:"teamWon"` TeamDrawn int32 `json:"teamDrawn"` TeamLost int32 `json:"teamLost"` TeamGF int32 `json:"teamGF"` TeamGA int32 `json:"teamGA"` TeamGD int32 `json:"teamGD"` TeamPoints int32 `json:"teamPoints"` TeamCapital int32 `json:"teamCapital"` }
Table struct holds League table data
Click to show internal directories.
Click to hide internal directories.