pga

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 19, 2023 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SortByScore

func SortByScore(players []statboard.Player) []statboard.Player

SortByScore sorts players by score

Types

type PGA

type PGA struct {
	sync.Mutex
	// contains filtered or unexported fields
}

PGA ...

func New

func New(logger *zap.Logger, updateInterval time.Duration) (*PGA, error)

New ...

func (*PGA) AvailableStats

func (p *PGA) AvailableStats(ctx context.Context, playerCategory string) ([]string, error)

AvailableStats ...

func (*PGA) FindPlayer

func (p *PGA) FindPlayer(ctx context.Context, firstName string, lastName string) (statboard.Player, error)

FindPlayer ...

func (*PGA) GetPlayer

func (p *PGA) GetPlayer(ctx context.Context, id string) (statboard.Player, error)

GetPlayer ...

func (*PGA) HTTPPathPrefix

func (p *PGA) HTTPPathPrefix() string

HTTPPathPrefix ...

func (*PGA) LeagueShortName

func (p *PGA) LeagueShortName() string

LeagueShortName ...

func (*PGA) ListPlayers

func (p *PGA) ListPlayers(ctx context.Context, teamAbbreviation string) ([]statboard.Player, error)

ListPlayers ...

func (*PGA) PlayerCategories

func (p *PGA) PlayerCategories() []string

PlayerCategories ...

func (*PGA) StatShortName

func (p *PGA) StatShortName(stat string) string

StatShortName ...

type Player

type Player struct {
	ID      string   `json:"id"`
	Athlete athlete  `json:"athlete"`
	Team    *athlete `json:"team"`
	Status  struct {
		TeeTime  string `json:"teeTime"`
		Hole     int    `json:"hole"`
		Thru     int    `json:"thru"`
		Position struct {
			DisplayName string `json:"displayName"`
			ID          string `json:"id"`
		}
	} `json:"status"`
	Score struct {
		DisplayValue string `json:"displayValue"`
	} `json:"score"`
	SortOrder  int `json:"sortOrder"`
	Statistics []*struct {
		Name         string `json:"name"`
		DisplayValue string `json:"displayValue"`
	} `json:"statistics"`
}

Player ...

func (*Player) FirstName

func (p *Player) FirstName() string

FirstName ...

func (*Player) GetCategory

func (p *Player) GetCategory() string

GetCategory ...

func (*Player) GetStat

func (p *Player) GetStat(stat string) string

GetStat ...

func (*Player) LastName

func (p *Player) LastName() string

LastName ...

func (*Player) Position

func (p *Player) Position() string

Position returns nothing

func (*Player) PrefixCol

func (p *Player) PrefixCol() string

PrefixCol returns the col before the player's name, leaderboard position

func (*Player) StatColor

func (p *Player) StatColor(stat string) color.Color

StatColor ...

func (*Player) UpdateStats

func (p *Player) UpdateStats(ctx context.Context) error

UpdateStats does nothing, as stats are collected on calls to ListPlayers

Jump to

Keyboard shortcuts

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