Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var StatusArray = []StatusType{ StatusClosed, StatusOpen, StatusVote, StatusVoteExpired, StatusResult, }
Functions ¶
func IsValidStatus ¶
func IsValidStatus(stat StatusType) bool
IsValidStatus returns whether stat is a declared status.
Types ¶
type Candidate ¶
type Candidate struct { // The unique id of candidate, used for identifying. ID int `json:"id" example:"1"` // The name of the candidates. Name []string `json:"name" db:"-"` NameInternal string `json:"-" db:"name" swaggerignore:"true"` // The description provided by the candidate, intended as a short introduction. Description null.String `json:"description" swaggertype:"string" example:"Hello. Vote for me."` // The picture of the candidate. Picture null.String `json:"picture" swaggertype:"string" format:"base64"` } // @name Candidate
Stores all candidate data
type CandidateEssay ¶
type CandidateEssay struct {
Essay string `json:"essay" format:"base64"`
}
type CandidateID ¶
type CandidateID struct {
Candidate int `json:"candidate" binding:"required"`
}
type CandidateResult ¶
type Error ¶
type Error struct { Error ErrorType `` /* 222-byte string literal not displayed */ } // @name Error
Error structure to be returned in case of a non 2xx status code.
type ErrorType ¶
type ErrorType string
Type for const errors.
const ( ErrNotFound ErrorType = "NOT_FOUND" ErrMethodNotAllowed ErrorType = "METHOD_NOT_ALLOWED" ErrServerError ErrorType = "SERVER_ERROR" ErrInvalidAuthHeader ErrorType = "INVALID_AUTH_HEADER" ErrExpiredToken ErrorType = "EXPIRED_TOKEN" ErrInvalidBody ErrorType = "INVALID_BODY" ErrBadPasscode ErrorType = "BAD_PASSCODE" ErrAlreadyVoted ErrorType = "ALREADY_VOTED" ErrNoSuchVoter ErrorType = "NO_SUCH_VOTER" ErrTooManyTries ErrorType = "TOO_MANY_TRIES" ErrNoSuchCandidate ErrorType = "NO_SUCH_CANDIDATE" ErrWrongStatus ErrorType = "WRONG_STATUS" )
Error types which are present in the swagger enums.
type Passcode ¶
type Passcode struct { Passcode string `json:"passcode" binding:"required"` } // @name Passcode
JSON object for receiving passcode
type StatusCurrent ¶
type StatusCurrent struct { Status StatusType `json:"current" enums:"CLOSED,OPEN,VOTE,VOTE_EXPIRED,RESULT" example:"CLOSED" binding:"required"` } // @name CurrentStatus
Type to be returned to /status/current
type StatusTiming ¶
type StatusTiming struct { Status StatusType `json:"status" db:"name" enums:"CLOSED,OPEN,VOTE,VOTE_EXPIRED,RESULT" example:"CLOSED" binding:"required"` Start time.Time `json:"start" db:"ts_start" binding:"required"` Until time.Time `json:"until" db:"ts_until" binding:"required"` }
func NewDummyTiming ¶
func NewDummyTiming(i int) *StatusTiming
type StatusType ¶
type StatusType string
Type for status types
const ( StatusClosed StatusType = "CLOSED" StatusOpen StatusType = "OPEN" StatusVote StatusType = "VOTE" StatusVoteExpired StatusType = "VOTE_EXPIRED" StatusResult StatusType = "RESULT" StatusAuto StatusType = "AUTO" )
Status types in swagger enum
type Token ¶
type Token struct { Token string `json:"token"` } // @name Token
JSON object for returning an auth token
type Vote ¶
type Vote struct { Voter CandidateID } // @name Vote
Data type containing voter id + chosen candidate
type Voter ¶
type Voter struct {
Om string `form:"om" json:"om" binding:"required"`
}
Data type containing voter id
type VoterStatus ¶
type VoterStatus int
Enum for voter status
const ( CanVote VoterStatus = iota AlreadyVoted WrongData )
VoterStatus states
Click to show internal directories.
Click to hide internal directories.