repository

package
v0.0.0-...-c2d312f Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2022 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Monitor

type Monitor interface {
	// Getting promo monitor.
	Get(ctx context.Context, id int, last bool) (domain.Monitor, error)
	// Updating promo monitor.
	Update(ctx context.Context, monitor domain.Monitor) error
}

type MonitorRepository

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

Monitor repository structure.

func NewMonitorRepository

func NewMonitorRepository(db *mongo.Database) *MonitorRepository

Creating a new monitor repository.

func (*MonitorRepository) Get

func (r *MonitorRepository) Get(ctx context.Context, id int, last bool) (domain.Monitor, error)

Getting promo monitor.

func (*MonitorRepository) Update

func (r *MonitorRepository) Update(ctx context.Context, monitor domain.Monitor) error

Updating promo monitor.

type Repository

type Repository struct {
	User    User
	Monitor Monitor
}

Repository structure.

func NewRepository

func NewRepository(db *mongo.Database) *Repository

Creating a new repository.

type User

type User interface {
	// Creating a new user.
	Create(ctx context.Context, user domain.User) error
	// Getting a user.
	Get(ctx context.Context, id string) (domain.User, error)
	// Updating a user promo code.
	UpdatePromo(ctx context.Context, id, promo string) error
	// Using a promo code.
	UsePromo(ctx context.Context, id, promo string, reward int) error
	// Updating a user balance.
	UpdateBalance(ctx context.Context, id string, amount int) error
}

User repository interface.

type UserRepository

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

User repository structure.

func NewUserRepository

func NewUserRepository(db *mongo.Database) *UserRepository

Creating a new user repository.

func (*UserRepository) Create

func (r *UserRepository) Create(ctx context.Context, user domain.User) error

Creating a new user.

func (*UserRepository) Get

func (r *UserRepository) Get(ctx context.Context, id string) (domain.User, error)

Getting a user.

func (*UserRepository) UpdateBalance

func (r *UserRepository) UpdateBalance(ctx context.Context, discordId string, amount int) error

Updating a user balance.

func (*UserRepository) UpdatePromo

func (r *UserRepository) UpdatePromo(ctx context.Context, id, promo string) error

Updating a user promo code.

func (*UserRepository) UsePromo

func (r *UserRepository) UsePromo(ctx context.Context, id, promo string, reward int) error

Using a promo code.

Jump to

Keyboard shortcuts

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