poll

package
v0.0.0-...-c8b7d6d Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Answer

type Answer interface {
	HasVoted(u User) bool
	GetContent() string
	GetID() string
	WithUser(User)
	WithVoters(map[string]User)
	GetWithUser() User
	ToggleVote(u User)
	MarshalJSON() ([]byte, error)
}

func NewAnswer

func NewAnswer(content string) Answer

type Poll

type Poll interface {
	AddAnswer(User, Answer)
	ListAnswers() map[string]Answer
	ToggleVote(User, Answer)
	GetAnswerByID(string) (Answer, error)
}

func New

func New(s Store) Poll

type Store

type Store interface {
	AddAnswer(User, Answer)
	ListAnswers() map[string]Answer
	ToggleVote(User, Answer)
	GetAnswerByID(string) (Answer, error)
}

func NewInMemoryStore

func NewInMemoryStore() Store

type User

type User interface {
	GetName() string
	GetID() string
}

func NewUser

func NewUser(name string) User

Jump to

Keyboard shortcuts

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