Documentation ¶
Index ¶
- Variables
- func CountUsers(x ...bun.IDB) (int, error)
- func CountVotesForElection(electionID int, x ...bun.IDB) (int, error)
- func DeleteAllCandidatesForUser(userID string, x ...bun.IDB) error
- func DeleteAllVotesForElection(electionID int, x ...bun.IDB) error
- func DeleteAllVotesForUser(userID string, x ...bun.IDB) error
- func DeleteBallotForElection(electionID int, x ...bun.IDB) error
- func DeleteCandidatesForElection(electionID int, x ...bun.IDB) error
- func DeleteElectionByID(electionID int, x ...bun.IDB) error
- func DeleteUser(id string, x ...bun.IDB) error
- func Get() *bun.DB
- func GetTx() (bun.Tx, error)
- func HasUserVotedInElection(userID string, electionID int, x ...bun.IDB) (bool, error)
- func Migrate(db *bun.DB) error
- type BallotEntry
- type Candidate
- type DB
- type Election
- type ElectionCandidate
- type ElectionWithCandidates
- type User
- type Vote
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNotFound = errors.New("not found")
View Source
var Migrations = migrate.NewMigrations()
Functions ¶
func HasUserVotedInElection ¶
Types ¶
type BallotEntry ¶
type BallotEntry struct { bun.BaseModel `bun:"ballot_entry" json:"-"` ID int `bun:",pk,autoincrement" json:"id"` ElectionID int `json:"electionID"` Name string `json:"name"` IsRON bool `json:"isRON"` }
func CreateBallot ¶
func GetAllBallotEntriesForElection ¶
func GetAllBallotEntriesForElection(electionID int, x ...bun.IDB) ([]*BallotEntry, error)
type Candidate ¶
type Election ¶
type Election struct { bun.BaseModel `json:"-"` ID int `bun:",pk,autoincrement" json:"id"` RoleName string `json:"roleName"` Description string `json:"description"` IsActive bool `json:"isActive"` }
func (*Election) WithCandidates ¶
func (e *Election) WithCandidates(x ...bun.IDB) (*ElectionWithCandidates, error)
type ElectionCandidate ¶
type ElectionWithCandidates ¶
type ElectionWithCandidates struct { Election Candidates []*ElectionCandidate `json:"candidates"` }
type User ¶
type User struct { bun.BaseModel `json:"-"` StudentID string `bun:"id,pk" json:"studentID"` Name string `json:"name"` PasswordHash []byte `json:"-"` IsRestricted bool `json:"isRestricted"` IsAdmin bool `json:"isAdmin"` }
Click to show internal directories.
Click to hide internal directories.