dbstorage

package
v0.0.0-...-1a43062 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidLoginPassword = errors.New("invalid login/password")
View Source
var ErrNoOrders = errors.New("orders not found")
View Source
var ErrNotEnoughFunds = errors.New("not enough funds")
View Source
var ErrOrderExists = errors.New("order early uploaded")
View Source
var ErrOrderExistsAnother = errors.New("order early uploaded another user")
View Source
var ErrUserAlreadyExists = errors.New("user with such credentials already exist")

Functions

This section is empty.

Types

type DBStorage

type DBStorage struct {
	DB *gorm.DB
}

func NewDB

func NewDB(dsn string) (DBStorage, error)

func (*DBStorage) Close

func (ds *DBStorage) Close() error

func (*DBStorage) CreateOrder

func (ds *DBStorage) CreateOrder(ctx context.Context, login string, order models.Order) error

func (*DBStorage) CreateUser

func (ds *DBStorage) CreateUser(ctx context.Context, user models.User) error

func (*DBStorage) DispatchGetOrders

func (ds *DBStorage) DispatchGetOrders(ctx context.Context, status string) ([]string, error)

func (*DBStorage) DispatchUpdateOrder

func (ds *DBStorage) DispatchUpdateOrder(ctx context.Context, order models.Order) error

func (*DBStorage) GetBalance

func (ds *DBStorage) GetBalance(ctx context.Context, login string) (*types.Balance, error)

func (*DBStorage) GetOrderLogs

func (ds *DBStorage) GetOrderLogs(ctx context.Context, login string) ([]models.OrderLog, error)

func (*DBStorage) GetOrders

func (ds *DBStorage) GetOrders(ctx context.Context, login string) ([]models.Order, error)

func (*DBStorage) GetUser

func (ds *DBStorage) GetUser(ctx context.Context, login string) (*models.User, error)

func (*DBStorage) InitDB

func (ds *DBStorage) InitDB() error

func (*DBStorage) WithdrawOrder

func (ds *DBStorage) WithdrawOrder(ctx context.Context, login string, orderLog models.OrderLog) error

Jump to

Keyboard shortcuts

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