mongodb

package
v0.0.0-...-d73c5c4 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMongoDB

func NewMongoDB(ctx context.Context, config Config) (*mongo.Client, error)

Types

type Card

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

func NewCard

func NewCard(collection *mongo.Collection) *Card

func (*Card) AddCardToDealer

func (c *Card) AddCardToDealer(ctx context.Context, telegramChatID int64, card core.Card) error

func (*Card) AddCardToPlayer

func (c *Card) AddCardToPlayer(ctx context.Context, telegramChatID int64, username string, card core.Card) error

func (*Card) DrawCardFromDeck

func (c *Card) DrawCardFromDeck(ctx context.Context, telegramChatID int64) (core.Card, error)

func (*Card) SetNewDeck

func (c *Card) SetNewDeck(ctx context.Context, telegramChatID int64, deck *core.Deck) error

type Chat

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

func NewChat

func NewChat(collection *mongo.Collection) *Chat

func (*Chat) CheckChatExists

func (c *Chat) CheckChatExists(ctx context.Context, telegramChatID int64) error

func (*Chat) RegisterChat

func (c *Chat) RegisterChat(ctx context.Context, telegramChatID int64) error

type Config

type Config struct {
	Scheme   string
	Host     string
	Username string
	Password string
}

type Game

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

func NewGame

func NewGame(collection *mongo.Collection) *Game

func (*Game) GetActiveGame

func (g *Game) GetActiveGame(ctx context.Context, telegramChatID int64) (*core.Game, error)

func (*Game) NullActiveGame

func (g *Game) NullActiveGame(ctx context.Context, telegramChatID int64) error

func (*Game) SetActiveGame

func (g *Game) SetActiveGame(ctx context.Context, telegramChatID int64, game core.Game) error

type Player

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

func NewPlayer

func NewPlayer(collection *mongo.Collection) *Player

func (*Player) AddNewPlayer

func (p *Player) AddNewPlayer(ctx context.Context, telegramChatID int64, player core.Player) error

func (*Player) GetPlayer

func (p *Player) GetPlayer(ctx context.Context, telegramChatID int64, username string) (*core.Player, error)

func (*Player) SetPlayerStopAndBusted

func (p *Player) SetPlayerStopAndBusted(ctx context.Context, telegramChatID int64, player *core.Player) error

type Statistic

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

func NewStatistic

func NewStatistic(collection *mongo.Collection) *Statistic

func (*Statistic) GetStatistics

func (s *Statistic) GetStatistics(ctx context.Context, telegramChatID int64) (core.UsersStatistics, error)

func (*Statistic) SetStatistics

func (s *Statistic) SetStatistics(ctx context.Context, telegramChatID int64, stats core.UsersStatistics) error

Jump to

Keyboard shortcuts

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