statboard

package
v0.0.21 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2021 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API interface {
	FindPlayer(ctx context.Context, firstName string, lastName string) (Player, error)
	GetPlayer(ctx context.Context, id string) (Player, error)
	AvailableStats(ctx context.Context, playerCategory string) ([]string, error)
	StatShortName(stat string) string
	ListPlayers(ctx context.Context, teamAbbreviation string) ([]Player, error)
	LeagueShortName() string
	HTTPPathPrefix() string
	PlayerCategories() []string
}

API ...

type Config

type Config struct {
	BoardDelay   string              `json:"boardDelay"`
	Enabled      *atomic.Bool        `json:"enabled"`
	Players      []string            `json:"players"`
	Teams        []string            `json:"teams"`
	StatOverride map[string][]string `json:"statOverride"`
	LimitPlayers int                 `json:"limitPlayers"`
	// contains filtered or unexported fields
}

Config ...

func (*Config) SetDefaults

func (c *Config) SetDefaults()

SetDefaults ...

type OptionFunc added in v0.0.20

type OptionFunc func(s *StatBoard) error

OptionFunc provides options to the StatBoard that are not exposed in a Config

func WithPrefixCol added in v0.0.20

func WithPrefixCol(with bool) OptionFunc

WithPrefixCol enables/disables the prefix column in the statboard

func WithSorter added in v0.0.20

func WithSorter(sorter Sorter) OptionFunc

WithSorter ...

func WithTitleRow added in v0.0.20

func WithTitleRow(with bool) OptionFunc

WithTitleRow enables/disables the stats title row

type Player

type Player interface {
	FirstName() string
	LastName() string
	GetStat(stat string) string
	StatColor(stat string) color.Color
	Position() string
	GetCategory() string
	UpdateStats(ctx context.Context) error
	PrefixCol() string
}

Player ...

type Sorter added in v0.0.20

type Sorter func(players []Player) []Player

Sorter sorts the ordering of a Player list for the stat board

type StatBoard

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

StatBoard ...

func New

func New(ctx context.Context, api API, config *Config, logger *zap.Logger, opts ...OptionFunc) (*StatBoard, error)

New ...

func (*StatBoard) Clear

func (s *StatBoard) Clear() error

Clear ...

func (*StatBoard) Close

func (s *StatBoard) Close() error

Close ...

func (*StatBoard) Disable

func (s *StatBoard) Disable()

Disable ..

func (*StatBoard) Enable

func (s *StatBoard) Enable()

Enable ...

func (*StatBoard) Enabled

func (s *StatBoard) Enabled() bool

Enabled ...

func (*StatBoard) GetHTTPHandlers

func (s *StatBoard) GetHTTPHandlers() ([]*board.HTTPHandler, error)

GetHTTPHandlers ...

func (*StatBoard) Name

func (s *StatBoard) Name() string

Name ...

func (*StatBoard) Render

func (s *StatBoard) Render(ctx context.Context, canvas board.Canvas) error

Render ...

type StringMeasurer added in v0.0.20

type StringMeasurer interface {
	MeasureStrings(canvas draw.Image, strs []string) ([]int, error)
}

StringMeasurer measures the width of strings as they would be written to a canvas

Jump to

Keyboard shortcuts

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