postgresql

package
v0.0.0-...-db2bfc3 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

work with db

Index

Constants

View Source
const (
	UniqueViolation = "duplicate key value violates unique constraint"
)

Variables

This section is empty.

Functions

func Init

func Init(config config) (*sql.DB, error)

Types

type Storage

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

func New

func New(db *sql.DB) (*Storage, error)

func (*Storage) AddOrder

func (s *Storage) AddOrder(ctx context.Context, order entity.Order, user entity.User) error

orders

func (*Storage) GetAllNotProcessedOrders

func (s *Storage) GetAllNotProcessedOrders(ctx context.Context) ([]entity.Order, error)

func (*Storage) GetAllOrders

func (s *Storage) GetAllOrders(ctx context.Context, user entity.User) ([]entity.Order, error)

func (*Storage) GetBalance

func (s *Storage) GetBalance(ctx context.Context, user entity.User) (entity.Balance, error)

balance

func (*Storage) GetUser

func (s *Storage) GetUser(ctx context.Context, userFromReq entity.User) (entity.User, error)

func (*Storage) SetOrderStatusAndAccrual

func (s *Storage) SetOrderStatusAndAccrual(ctx context.Context, order entity.Order) error

func (*Storage) UserLogin

func (s *Storage) UserLogin(ctx context.Context, user entity.User) error

auth user or return ErrUserLoginUnauthorized

func (*Storage) UserRegister

func (s *Storage) UserRegister(ctx context.Context, user entity.User) (int64, error)

func (*Storage) WithdrawBalance

func (s *Storage) WithdrawBalance(ctx context.Context, balance entity.BalanceUpdate, user entity.User) error

func (*Storage) Withdrawals

func (s *Storage) Withdrawals(ctx context.Context, user entity.User) ([]entity.BalanceUpdate, error)

Withdrawals

Jump to

Keyboard shortcuts

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