model

package
v0.0.0-...-b2480b3 Latest Latest
Warning

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

Go to latest
Published: May 28, 2024 License: MPL-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoROTIMatchingThisID = errors.New("no ROTI matching this ID")
	ErrNoFreeIDs            = errors.New("couldn't find a free ID for this ROTI")
)
View Source
var (
	ErrInvalidVoteID = errors.New("invalid vote ID")
	ErrInvalidVote   = errors.New("invalid vote value")
)
View Source
var (
	ErrInvalidROTIID = errors.New("invalid ROTI ID")
)

Functions

func CheckVote

func CheckVote(voteString string) (vote float64, err error)

func CountROTIs

func CountROTIs() int

func GetMaxROTIID

func GetMaxROTIID() int

func InitDatabase

func InitDatabase() *sql.DB

Types

type ROTIEntity

type ROTIEntity struct {
	// contains filtered or unexported fields
}

func GetROTI

func GetROTI(rotiid ROTIID) (roti ROTIEntity, err error)

func NewROTIEntity

func NewROTIEntity(id ROTIID, description string, hide, feedback bool) (roti ROTIEntity)

func (*ROTIEntity) AddVoteToROTI

func (currentROTI *ROTIEntity) AddVoteToROTI(value float64, feedback string) (err error)

func (*ROTIEntity) CountVotes

func (currentROTI *ROTIEntity) CountVotes() int

func (*ROTIEntity) GetDescription

func (currentROTI *ROTIEntity) GetDescription() string

func (*ROTIEntity) GetID

func (currentROTI *ROTIEntity) GetID() ROTIID

func (*ROTIEntity) GetMaxVote

func (currentROTI *ROTIEntity) GetMaxVote() float64

func (*ROTIEntity) GetMinVote

func (currentROTI *ROTIEntity) GetMinVote() float64

func (*ROTIEntity) HasFeedback

func (currentROTI *ROTIEntity) HasFeedback() bool

func (*ROTIEntity) IsHidden

func (currentROTI *ROTIEntity) IsHidden() bool

func (*ROTIEntity) ListFeedbacks

func (currentROTI *ROTIEntity) ListFeedbacks() (feedbacks []string)

func (*ROTIEntity) VotesAverage

func (currentROTI *ROTIEntity) VotesAverage() float64

type ROTIID

type ROTIID int

func CreateROTI

func CreateROTI(description string, hide, feedback bool, clean int) (rotiID ROTIID)

func NewROTIID

func NewROTIID() (rotiID ROTIID)

func (ROTIID) Int

func (id ROTIID) Int() int

type ShortROTIInfo

type ShortROTIInfo struct {
	ID   ROTIID
	Desc string
}

func ListROTIs

func ListROTIs() (rotis []ShortROTIInfo)

type VoteEntity

type VoteEntity struct {
	// contains filtered or unexported fields
}

func NewVoteEntity

func NewVoteEntity(value float64) (vote VoteEntity, err error)

func (*VoteEntity) GetVote

func (currentVote *VoteEntity) GetVote() float64

func (*VoteEntity) ID

func (currentVote *VoteEntity) ID() VoteID

type VoteID

type VoteID string

func (VoteID) String

func (id VoteID) String() string

Jump to

Keyboard shortcuts

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