lsdb

package module
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: May 2, 2023 License: GPL-3.0 Imports: 9 Imported by: 2

README

Go Report Card GoDoc

LSDB (Lottery system DB Layer)

Lottery System DB Layer to Interact with the DB

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	ConnectionURI string
	*mongo.Client
	*mongo.Database
}

func NewClient

func NewClient() (*Client, error)

func (*Client) AddNewEvent

func (c *Client) AddNewEvent(event LotteryEventInfo) error

func (*Client) AddNewUserInfo

func (c *Client) AddNewUserInfo(userInfo UserInfo) error

func (*Client) AddNewWinner added in v0.0.6

func (c *Client) AddNewWinner(winnerInfo WinnerInfo) error

func (*Client) AddUserBet added in v0.0.5

func (c *Client) AddUserBet(participantInfo EventParticipantInfo) error

func (*Client) CloseConnection

func (c *Client) CloseConnection() error

func (*Client) DeleteEvent

func (c *Client) DeleteEvent(eventID primitive.ObjectID) error

func (*Client) DeleteUserBet added in v0.0.5

func (c *Client) DeleteUserBet(betUID primitive.ObjectID) error

func (*Client) DeleteUserInfo

func (c *Client) DeleteUserInfo(userInfo UserInfo) error

func (*Client) GetAllEvents

func (c *Client) GetAllEvents() ([]LotteryEventInfo, error)

func (*Client) GetEventByDateRange

func (c *Client) GetEventByDateRange(startDate, endDate primitive.DateTime) ([]LotteryEventInfo, error)

func (*Client) GetEventWinners added in v0.0.6

func (c *Client) GetEventWinners(eventID primitive.ObjectID) ([]WinnerInfo, error)

func (*Client) GetEventsByDate

func (c *Client) GetEventsByDate(date primitive.DateTime) ([]LotteryEventInfo, error)

func (*Client) GetEventsByType

func (c *Client) GetEventsByType(eventType string) ([]LotteryEventInfo, error)

func (*Client) GetParticipantsInfoByEventID added in v0.0.5

func (c *Client) GetParticipantsInfoByEventID(eventID primitive.ObjectID) ([]EventParticipantInfo, error)

func (*Client) GetUserBets added in v0.0.5

func (c *Client) GetUserBets(userID primitive.ObjectID) ([]EventParticipantInfo, error)

func (*Client) GetUserInfoByGovID

func (c *Client) GetUserInfoByGovID(govID string) (*UserInfo, error)

func (*Client) GetUserInfoByID

func (c *Client) GetUserInfoByID(id primitive.ObjectID) (*UserInfo, error)

func (*Client) GetUserInfoByPhone

func (c *Client) GetUserInfoByPhone(phoneNumber int64) (*UserInfo, error)

func (*Client) OpenConnection

func (c *Client) OpenConnection() error

func (*Client) UpdateEvent

func (c *Client) UpdateEvent(event LotteryEventInfo) error

func (*Client) UpdateUserBet added in v0.0.5

func (c *Client) UpdateUserBet(updatedInfo EventParticipantInfo) error

func (*Client) UpdateUserInfo

func (c *Client) UpdateUserInfo(uid primitive.ObjectID, key, value string) error

type EventParticipantInfo

type EventParticipantInfo struct {
	BetUID          primitive.ObjectID `bson:"_id,omitempty"`
	EventUID        primitive.ObjectID `bson:"event_id,omitempty"`
	ParticipantInfo `bson:"participant_info,omitempty"`
	CreatedAt       primitive.DateTime `bson:"created_at,omitempty"`
	UpdatedAt       primitive.DateTime `bson:"updated_at,omitempty"`
}

type LotteryEventInfo

type LotteryEventInfo struct {
	EventUID      primitive.ObjectID `bson:"_id,omitempty"`
	EventDate     primitive.DateTime `bson:"event_date,omitempty"`
	Name          string             `bson:"name,omitempty"`
	EventType     string             `bson:"event_type,omitempty"`
	WinningNumber []int              `bson:"winning_number,omitempty"`
	CreatedAt     primitive.DateTime `bson:"created_at,omitempty"`
	UpdatedAt     primitive.DateTime `bson:"updated_at,omitempty"`
}

type ParticipantInfo

type ParticipantInfo struct {
	UserID     primitive.ObjectID `bson:"user_id,omitempty"`
	BetNumbers []int              `bson:"bet_numbers,omitempty"`
	Amount     int                `bson:"amount,omitempty"`
}

type UserInfo

type UserInfo struct {
	UID       primitive.ObjectID `bson:"_id,omitempty"`
	Name      string             `bson:"name,omitempty"`
	Phone     int64              `bson:"phone,omitempty"`
	GovID     string             `bson:"gov_id,omitempty"`
	EMail     string             `bson:"e_mail,omitempty"`
	CreatedAT string             `bson:"created_at,omitempty"`
	UpdatedAT string             `bson:"updated_at,omitempty"`
}

func GetAllUserInfo

func GetAllUserInfo() ([]UserInfo, error)

type WinnerInfo

type WinnerInfo struct {
	EventID   primitive.ObjectID `bson:"event_id,omitempty"`
	UserID    primitive.ObjectID `bson:"user_id,omitempty"`
	WinType   string             `bson:"win_type,omitempty"`
	AmountWon int                `bson:"amount_won,omitempty"`
	CreatedAt primitive.DateTime `bson:"created_at,omitempty"`
}

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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