caterings

package
v0.0.0-...-9af3b72 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteByUUID

func DeleteByUUID(uuid uuid.UUID) bool

Types

type Catering

type Catering struct {
	UUID       uuid.UUID `json:"uuid"`
	Info       Info      `json:"info"`
	Tournament uuid.UUID `json:"tournament"`
	Votes      []Vote    `json:"votes"`
}

func AllCaterings

func AllCaterings() ([]*Catering, error)

func CateringByUUID

func CateringByUUID(uuid uuid.UUID) (*Catering, error)

func NewCatering

func NewCatering(tournament uuid.UUID, ci Info) (*Catering, error)

Create a Catering

func (*Catering) AddVote

func (c *Catering) AddVote(player uuid.UUID, score int) error

func (*Catering) RemoveVote

func (c *Catering) RemoveVote(player uuid.UUID) error

func (*Catering) UpdateInfo

func (c *Catering) UpdateInfo(ci Info) error

type CateringStorage

type CateringStorage interface {
	Store(*Catering) error
	Delete(uuid.UUID) error
	Load(uuid.UUID) (*Catering, error)
	LoadAll() ([]*Catering, error)
	LoadByTournament(uuid.UUID) (*Catering, error)
}

A storage interface for Caterings

type Info

type Info struct {
	Caterer uuid.UUID `json:"caterer"`
	Meal    string    `json:"meal"`
}

type RedisCateringStorage

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

func NewRedisCateringStorage

func NewRedisCateringStorage() *RedisCateringStorage

func (*RedisCateringStorage) Delete

func (rcs *RedisCateringStorage) Delete(uuid uuid.UUID) error

func (*RedisCateringStorage) Load

func (rcs *RedisCateringStorage) Load(uuid uuid.UUID) (*Catering, error)

func (*RedisCateringStorage) LoadAll

func (rcs *RedisCateringStorage) LoadAll() ([]*Catering, error)

func (*RedisCateringStorage) LoadByTournament

func (rcs *RedisCateringStorage) LoadByTournament(tournament uuid.UUID) (*Catering, error)

func (*RedisCateringStorage) Store

func (rcs *RedisCateringStorage) Store(c *Catering) error

type Vote

type Vote struct {
	Player uuid.UUID `json:"player"`
	Score  int       `json:"score"`
}

Jump to

Keyboard shortcuts

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