Documentation ¶
Index ¶
- Variables
- func AddTiming(t *types.StatusTiming) error
- func CheckVoter(v *types.Voter) (types.VoterStatus, error)
- func ClearTimings() error
- func Connect(sl *zap.SugaredLogger) (err error)
- func Fail2BanCheck(ip string) (int, error)
- func Fail2BanFail(ip string) error
- func GetCandidateEssay(id int) (*types.CandidateEssay, error)
- func GetCandidates() (candidates []*types.Candidate, err error)
- func GetCurrentStatus() (types.StatusType, error)
- func GetResults() ([]types.CandidateResult, error)
- func GetTimings() (timings []*types.StatusTiming, err error)
- func GetWinner() ([]*types.CandidateID, error)
- func RemoveTiming(t types.StatusType) error
- func SetCurrentStatus(stat types.StatusType) error
- func Vote(v *types.Vote) error
- func VoteStat() ([]*types.VoteStat, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrForeignKeyViolation = errors.New("violated foreign key")
ErrForeignKeyViolation is an error for foreign key or unique constraint breaks
Functions ¶
func AddTiming ¶
func AddTiming(t *types.StatusTiming) error
func CheckVoter ¶
func CheckVoter(v *types.Voter) (types.VoterStatus, error)
CheckVoter returns whether the user can vote or not
func ClearTimings ¶
func ClearTimings() error
func Connect ¶
func Connect(sl *zap.SugaredLogger) (err error)
Connect to database. Must not be called more than once.
func Fail2BanCheck ¶
Fail2BanCheck is the db backend of handlers.Fail2BanMiddleware
func Fail2BanFail ¶
Fail2BanFail creates a fail record for the ip
func GetCandidateEssay ¶
func GetCandidateEssay(id int) (*types.CandidateEssay, error)
func GetCandidates ¶
GetCandidates returns all the candidates.
func GetCurrentStatus ¶
func GetCurrentStatus() (types.StatusType, error)
GetCurrentStatus returns the current status.. If it doesn't exist, it is created.
func GetResults ¶
func GetResults() ([]types.CandidateResult, error)
GetResults returns the vote counts for each candidate
func GetTimings ¶
func GetTimings() (timings []*types.StatusTiming, err error)
func GetWinner ¶
func GetWinner() ([]*types.CandidateID, error)
GetWinner returns the winner(s) based on the number of vote objects
func RemoveTiming ¶
func RemoveTiming(t types.StatusType) error
func SetCurrentStatus ¶
func SetCurrentStatus(stat types.StatusType) error
SetCurrentStatus sets the current status
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.