score

package
v0.0.0-...-adebd87 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2017 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConnectionPool

type ConnectionPool interface {
	Cmd(cmd string, args ...interface{}) *redis.Resp
}

ConnectionPool used to make requests to Redis. Its size is provided by Configuration during application init.

type Keeper

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

Keeper is an implemetation of ScoreKeeper that uses Redis.

func NewKeeper

func NewKeeper(p ConnectionPool) *Keeper

NewKeeper returns pointer to created Keeper instance initialized with Redis pool.

func (Keeper) AddCandidate

func (d Keeper) AddCandidate(p string) error

AddCandidate adds the one to current voting.

func (Keeper) AddCountry

func (d Keeper) AddCountry(c string) error

AddCountry will create country record in set of all countries.

func (Keeper) AddPoint

func (d Keeper) AddPoint(key string) error

AddPoint increments counter by one for a given key.

func (Keeper) Get

func (d Keeper) Get(key string) (int, error)

Get returns current score for given key.

func (Keeper) GetAllCandidates

func (d Keeper) GetAllCandidates() ([]string, error)

GetAllCandidates returns all candidates currently taking part in voting.

func (Keeper) GetAllCountries

func (d Keeper) GetAllCountries() ([]string, error)

GetAllCountries returnes all countries that were participating during voting.

func (Keeper) RemoveCandidate

func (d Keeper) RemoveCandidate(p string) error

RemoveCandidate deletes single candidate with specified name.

Jump to

Keyboard shortcuts

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