model

package
v0.0.0-...-87370ed Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UpdateVote

func UpdateVote(id int, v Vote)

UpdateVote - create new vote in database.

Types

type Engine

type Engine struct{ *gorm.DB }

Engine - base engine connector to data store.

func GetEngine

func GetEngine() *Engine

GetEngine - return engine instance.

type Reminder

type Reminder struct {
	gorm.Model

	ReminderID int `json:"reminder_id"`
	VoteID     int `json:"vote_id"`
	Vote       Vote
}

Reminder - model that represents remiders fot vote.

func CreateReminder

func CreateReminder(voteID int) *Reminder

CreateReminder - creates new reminder for passed voteID.

func GetReminderByVoteID

func GetReminderByVoteID(voteID int) *Reminder

GetReminderByVoteID - retrieves Reminder for passed voteID.

type Vote

type Vote struct {
	gorm.Model

	VoteID     int    `json:"vote_id"`
	UserID     int    `json:"user_id"`
	VoterName  string `json:"voter_name"`
	FirstName  string `json:"voter_first_name"`
	LastName   string `json:"voter_last_name"`
	PressedBtn string `json:"pressed_btn"`
}

Vote - model for user collection.

func CreateVote

func CreateVote(v *Vote) Vote

CreateVote - create new vote in database.

func GetVote

func GetVote(id int) Vote

GetVote - return vote by `id`.

func GetVotes

func GetVotes(where ...string) []Vote

GetVotes - return votes list.

func GetVotesByVoteID

func GetVotesByVoteID(voteID int) []Vote

GetVotesByVoteID - return votes by vote id.

type VoteResult

type VoteResult struct {
	PressedBtn string
	Count      int
}

VoteResult - represent vote results by vote id.

func GetVoteResult

func GetVoteResult(voteID int) []VoteResult

GetVoteResult - return votes count for vote id.

Jump to

Keyboard shortcuts

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