statboard

package
v0.1.0 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: 21 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"`
	StartEnabled   *atomic.Bool        `json:"enabled"`
	Players        []string            `json:"players"`
	Teams          []string            `json:"teams"`
	StatOverride   map[string][]string `json:"statOverride"`
	LimitPlayers   int                 `json:"limitPlayers"`
	UpdateInterval string              `json:"updateInterval"`
	OnTimes        []string            `json:"onTimes"`
	OffTimes       []string            `json:"offTimes"`
	// contains filtered or unexported fields
}

Config ...

func (*Config) SetDefaults

func (c *Config) SetDefaults()

SetDefaults ...

type OptionFunc

type OptionFunc func(s *StatBoard) error

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

func WithPrefixCol

func WithPrefixCol(with bool) OptionFunc

WithPrefixCol enables/disables the prefix column in the statboard

func WithSorter

func WithSorter(sorter Sorter) OptionFunc

WithSorter ...

func WithTitleRow

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 Server

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

Server ...

func (*Server) GetStatus

func (s *Server) GetStatus(ctx context.Context, req *emptypb.Empty) (*pb.StatusResp, error)

GetStatus ...

func (*Server) SetStatus

func (s *Server) SetStatus(ctx context.Context, req *pb.SetStatusReq) (*emptypb.Empty, error)

SetStatus ...

type Sorter

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) Enabler

func (s *StatBoard) Enabler() board.Enabler

func (*StatBoard) GetHTTPHandlers

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

GetHTTPHandlers ...

func (*StatBoard) GetRPCHandler

func (s *StatBoard) GetRPCHandler() (string, http.Handler)

GetRPCHandler ...

func (*StatBoard) InBetween

func (s *StatBoard) InBetween() bool

InBetween ...

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

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