Documentation ¶
Index ¶
- Variables
- func NewCastVoteHandler(repository electionrepository.Repository, clock clock.Clock) *castVoteHandler
- func NewCloseElectionByOwnerHandler(repository electionrepository.Repository, clock clock.Clock) *closeElectionByOwnerHandler
- func NewCommenceElectionHandler(repository electionrepository.Repository, clock clock.Clock) *commenceElectionHandler
- func NewGetElectionHandler(repository electionrepository.Repository) *getElectionHandler
- func NewGetElectionResultsHandler(repository electionrepository.Repository) *getElectionResultsHandler
- func NewGetProposalDetailsHandler(repository electionrepository.Repository) *getProposalDetailsHandler
- func NewListOpenElectionsHandler(repository electionrepository.Repository) *listOpenElectionsHandler
- func NewListProposalsHandler(repository electionrepository.Repository) *listProposalsHandler
- func NewMakeProposalHandler(repository electionrepository.Repository, clock clock.Clock) *makeProposalHandler
- type CastVote
- type CloseElectionByOwner
- type CommenceElection
- type GetElection
- type GetElectionResponse
- type GetElectionResults
- type GetElectionResultsResponse
- type GetProposalDetails
- type GetProposalDetailsResponse
- type ListOpenElections
- type ListOpenElectionsResponse
- type ListProposals
- type ListProposalsResponse
- type MakeProposal
- type OpenElection
- type Proposal
Constants ¶
This section is empty.
Variables ¶
var ErrNoVotesFound = errors.New("no votes found for election")
Functions ¶
func NewCastVoteHandler ¶
func NewCastVoteHandler(repository electionrepository.Repository, clock clock.Clock) *castVoteHandler
func NewCloseElectionByOwnerHandler ¶
func NewCloseElectionByOwnerHandler( repository electionrepository.Repository, clock clock.Clock, ) *closeElectionByOwnerHandler
func NewCommenceElectionHandler ¶
func NewCommenceElectionHandler(repository electionrepository.Repository, clock clock.Clock) *commenceElectionHandler
func NewGetElectionHandler ¶
func NewGetElectionHandler(repository electionrepository.Repository) *getElectionHandler
func NewGetElectionResultsHandler ¶
func NewGetElectionResultsHandler(repository electionrepository.Repository) *getElectionResultsHandler
func NewGetProposalDetailsHandler ¶
func NewGetProposalDetailsHandler(repository electionrepository.Repository) *getProposalDetailsHandler
func NewListOpenElectionsHandler ¶
func NewListOpenElectionsHandler(repository electionrepository.Repository) *listOpenElectionsHandler
func NewListProposalsHandler ¶
func NewListProposalsHandler(repository electionrepository.Repository) *listProposalsHandler
func NewMakeProposalHandler ¶
func NewMakeProposalHandler(repository electionrepository.Repository, clock clock.Clock) *makeProposalHandler
Types ¶
type CastVote ¶
CastVote casts a ballot for a given ElectionID. RankedProposalIDs contains the ranked candidates in order of preference: first, second, third and so forth. If your first choice doesn’t have a chance to win, your ballot counts for your next choice.
type CloseElectionByOwner ¶
CloseElectionByOwner is an asynchronous command that closes an election and calculates a winner by using the Ranked Choice Voting (RCV) electoral system.
type CommenceElection ¶
type CommenceElection struct { ElectionID string OrganizerUserID string Name string Description string }
CommenceElection instantiates a new open election that is ready for proposals and voting.
type GetElection ¶
type GetElection struct {
ElectionID string
}
GetElection returns a single election by ElectionID.
type GetElectionResponse ¶
type GetElectionResults ¶
type GetElectionResults struct {
ElectionID string
}
GetElectionResults returns the results of an election.
type GetProposalDetails ¶
type GetProposalDetails struct {
ProposalID string
}
GetProposalDetails returns the full details of a Proposal.
type ListOpenElections ¶
ListOpenElections returns a paginated result of elections that are still open.
func (ListOpenElections) ValidationRules ¶
func (q ListOpenElections) ValidationRules() cqrs.ValidationRuleMap
type ListOpenElectionsResponse ¶
type ListOpenElectionsResponse struct { OpenElections []OpenElection TotalResults int }
type ListProposals ¶
ListProposals returns a paginated result of election proposals. Sortable options are omitted for this example.
func (ListProposals) ValidationRules ¶
func (q ListProposals) ValidationRules() cqrs.ValidationRuleMap
type ListProposalsResponse ¶
type MakeProposal ¶
type MakeProposal struct { ElectionID string ProposalID string OwnerUserID string Name string Description string }
MakeProposal instantiates a new proposal for a given ElectionID.
type OpenElection ¶
type OpenElection struct { ElectionID string OrganizerUserID string Name string Description string CommencedAt int }
func ToOpenElection ¶
func ToOpenElection(election electionrepository.Election) OpenElection
func ToOpenElections ¶
func ToOpenElections(elections []electionrepository.Election) []OpenElection
type Proposal ¶
type Proposal struct { ElectionID string ProposalID string OwnerUserID string Name string Description string ProposedAt int }
func ToProposal ¶
func ToProposal(proposal electionrepository.Proposal) Proposal
func ToProposals ¶
func ToProposals(repoProposals []electionrepository.Proposal) []Proposal