Documentation ¶
Index ¶
- Variables
- func SumScores(scores []Votes) map[string]int
- type Battle
- type DB
- func (db *DB) CloseBattle(battleName string) error
- func (db *DB) GetAllBattles() ([]Battle, error)
- func (db *DB) GetAllVotes(battleName string) ([]Votes, error)
- func (db *DB) GetBattle(battleName string) (*Battle, error)
- func (db *DB) GetVotes(battleName string, voterID string) (*Votes, error)
- func (db *DB) HideBattle(battleName string) error
- func (db *DB) OpenBattle(battleName string) error
- func (db *DB) RemoveVotes(battleName string, voterID string) error
- func (db *DB) UnhideBattle(battleName string) error
- func (db *DB) UpdateBattle(fsBattle scanner.Battle) error
- func (db *DB) UpdateVote(battleName string, entryID string, voterID string, score int) error
- type Entries
- type Entry
- type Places
- type ScoreMap
- type Votes
Constants ¶
This section is empty.
Variables ¶
View Source
var ( NotFound = errors.New("not found") InvalidScore = errors.New("invalid score") )
Functions ¶
Types ¶
type Battle ¶
type Battle struct { Name string `yaml:"name"` Entries Entries `yaml:"entries"` ClosedAt time.Time `yaml:"closed_at"` CreatedAt time.Time `yaml:"crated_at"` Hidden bool `yaml:"hidden"` }
func (*Battle) GetEntryByFilename ¶
func (Battle) IsVotingOpen ¶
type DB ¶
func (*DB) CloseBattle ¶
func (*DB) GetAllBattles ¶
func (*DB) HideBattle ¶
func (*DB) OpenBattle ¶
func (*DB) UnhideBattle ¶
type Entries ¶
type Entries []Entry
func (Entries) SortByName ¶
func (e Entries) SortByName()
func (Entries) SortByScore ¶
type Votes ¶
type Votes struct { BattleName string `yaml:"battle"` VoterID string `yaml:"voter_id"` CreatedAt time.Time `yaml:"created_at"` UpdatedAt time.Time `yaml:"updated_at"` Scores ScoreMap `yaml:"score"` }
func (*Votes) UpdateScore ¶
SetScore updates the scores map in a way where one score value is uniqe among the values.
Click to show internal directories.
Click to hide internal directories.