core

package
v0.0.0-...-ce8d5b4 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2024 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MelGenerator

func MelGenerator(turns int) []int

func RandomNumber

func RandomNumber(max int, zeroInclude bool) int

func TicketNumber

func TicketNumber(numbers int) string

Types

type Participant

type Participant struct {
	ID   primitive.ObjectID `json:"id" bson:"_id"`
	Name string             `json:"name" bson:"name"`
}

type Raffle

type Raffle struct {
	ID           primitive.ObjectID  `json:"id,omitempty" bson:"_id"`
	Name         string              `json:"name" bson:"name"`
	Prize        string              `json:"prize" bson:"prize"`
	MaxTickets   int                 `json:"max_tickets" bson:"max_tickets"`
	Participants []RaffleParticipant `json:"participants,omitempty" bson:"participants"`
	FirstTaken   bool                `json:"first_taken" bson:"first_taken"`
	Turns        int                 `json:"turns" bson:"turns"`
	Tickets      []string            `json:"tickets" bson:"tickets"`
	Log          []string            `json:"log,omitempty" bson:"log"`
	CreatedAt    time.Time           `json:"createdAt" bson:"created_at"`
	UpdatedAt    time.Time           `json:"updatedAt" bson:"updated_at"`
	Open         bool                `json:"open" bson:"open"`
	Winner       RaffleParticipant   `json:"winner,omitempty" bson:"winner"`
	TicketWinner string              `json:"ticket_winner,omitempty" bson:"ticket_winner"`
}

func (*Raffle) AddParticipant

func (r *Raffle) AddParticipant(newParticipant RaffleParticipant) error

func (*Raffle) AddTicketToParticipant

func (r *Raffle) AddTicketToParticipant(ticketSelected string, isRandom bool, participant string) (bool, error)

func (*Raffle) DeleteParticipant

func (r *Raffle) DeleteParticipant(id string) error

func (*Raffle) DiscardTicket

func (r *Raffle) DiscardTicket() (string, error)

func (*Raffle) Prepare

func (r *Raffle) Prepare()

func (*Raffle) PrintParticipants

func (r *Raffle) PrintParticipants()

func (*Raffle) SelectWinner

func (r *Raffle) SelectWinner() error

func (*Raffle) ToString

func (r *Raffle) ToString() string

type RaffleParticipant

type RaffleParticipant struct {
	Participant `json:"participants" bson:"participants"`
	Tickets     []string `json:"tickets" bson:"tickets"`
}

type Tanda

type Tanda struct {
	ID           primitive.ObjectID `json:"id,omitempty" bson:"_id"`
	Participants []TandaParticipant `json:"participants" bson:"participants"`
	Name         string             `json:"name" bson:"name"`
	NumbersTotal int                `json:"numbers_total" bson:"numbers_total"`
}

type TandaParticipant

type TandaParticipant struct {
	Participant `json:"participants" bson:"participants"`
	Numbers     []int `json:"numbers" bson:"numbers"`
}

Jump to

Keyboard shortcuts

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