store

package
v0.0.0-...-107fb91 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetEnteredRaffles

func GetEnteredRaffles(tx *sql.Tx, object interface{}, parameter interface{}) error

func GetMyRaffles

func GetMyRaffles(tx *sql.Tx, object interface{}, parameter interface{}) error

func GetRaffle

func GetRaffle(tx *sql.Tx, object interface{}, parameter interface{}) error

func GetRafflesFromList

func GetRafflesFromList(tx *sql.Tx, object, parameter interface{}, query string) error

func Init

func Init(dburl string) error

func RaffleDraw

func RaffleDraw(raffle_id string, entries []Entry, scores []Score) (*Entry, []Score)

precondition: entries must be filtered to include only active, non-disqualified ones

func Transact

func Transact(object interface{}, parameters interface{}, db_func func(*sql.Tx, interface{}, interface{}) error) error

Types

type Entry

type Entry struct {
	RaffleId     string
	UserId       int
	Entered      bool
	Disqualified bool
	Name         string
}

type Raffle

type Raffle struct {
	Id        string
	Display   string
	Owner     int
	Tiers     []int32
	Timestamp int64
	IsOpen    bool
}

func CreateRaffle

func CreateRaffle(owner int, name string, tiers []int32) (*Raffle, error)

func (*Raffle) Cancel

func (this *Raffle) Cancel() (bool, error)

func (*Raffle) Close

func (this *Raffle) Close() (bool, error)

func (*Raffle) Disqualify

func (this *Raffle) Disqualify(user_id int) (bool, error)

func (*Raffle) Draw

func (this *Raffle) Draw() (*Entry, error)

func (*Raffle) Enter

func (this *Raffle) Enter(user_id int, display string) (bool, error)

func (*Raffle) Open

func (this *Raffle) Open() (bool, error)

func (*Raffle) Status

func (this *Raffle) Status(user_id int) (*Entry, error)

func (*Raffle) Undisqualify

func (this *Raffle) Undisqualify(user_id int) (*Entry, error)

func (*Raffle) Withdraw

func (this *Raffle) Withdraw(user_id int, display string) (bool, error)

type Score

type Score struct {
	RaffleId      string
	UserId        int
	Name          string
	Score         float64
	LifetimeScore float64
}

Jump to

Keyboard shortcuts

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