Documentation ¶
Index ¶
- Variables
- type Repo
- type RepoPostgreSQL
- func (repo RepoPostgreSQL) Close() error
- func (repo RepoPostgreSQL) FindBalance(ctx context.Context, client models.Client) (balance *models.Balace, err error)
- func (repo RepoPostgreSQL) FindClient(ctx context.Context, client models.Client) (clientID int, err error)
- func (repo RepoPostgreSQL) FindOrders(ctx context.Context, client models.Client) (orders []models.Order, err error)
- func (repo RepoPostgreSQL) FindTasks(ctx context.Context, statuses ...string) (tasks []models.Task, err error)
- func (repo RepoPostgreSQL) FindWithdrawals(ctx context.Context, client models.Client) (withdrawals []models.Withdrawal, err error)
- func (repo RepoPostgreSQL) Ping(ctx context.Context) error
- func (repo RepoPostgreSQL) SaveClient(ctx context.Context, client models.Client) (clientID int, err error)
- func (repo RepoPostgreSQL) SaveOrder(ctx context.Context, order *models.Order) (err error)
- func (repo RepoPostgreSQL) SaveTask(ctx context.Context, task models.Task) (err error)
- func (repo RepoPostgreSQL) SaveWithdrawal(ctx context.Context, withdrawal *models.Withdrawal) (err error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNoDBConn = errors.New("no database connection") ErrLoginIsAlreadyTaken = errors.New("login is already taken") ErrInvalidLoginPasswordPair = errors.New("invalid login/password pair") ErrOrderNumberUploadedThisClient = errors.New("order number has been uploaded by this client") ErrOrderNumberUploadedAnotherClient = errors.New("order number has been uploaded by another client") ErrThereAreNotEnoughAccrual = errors.New("there are not enough accrual") )
Functions ¶
This section is empty.
Types ¶
type Repo ¶
type Repo interface { SaveClient(context.Context, models.Client) (id int, err error) FindClient(context.Context, models.Client) (id int, err error) SaveOrder(context.Context, *models.Order) (err error) FindOrders(context.Context, models.Client) (orders []models.Order, err error) SaveWithdrawal(context.Context, *models.Withdrawal) (err error) FindWithdrawals(context.Context, models.Client) (withdrawals []models.Withdrawal, err error) FindBalance(context.Context, models.Client) (balance *models.Balace, err error) SaveTask(context.Context, models.Task) (err error) FindTasks(context.Context, ...string) (tasks []models.Task, err error) Ping(context.Context) error Close() error }
type RepoPostgreSQL ¶
type RepoPostgreSQL struct {
// contains filtered or unexported fields
}
func NewRepositoryPostgreSQL ¶
func NewRepositoryPostgreSQL(dsn string) (repo RepoPostgreSQL, err error)
func (RepoPostgreSQL) Close ¶
func (repo RepoPostgreSQL) Close() error
func (RepoPostgreSQL) FindBalance ¶
func (RepoPostgreSQL) FindClient ¶
func (RepoPostgreSQL) FindOrders ¶
func (RepoPostgreSQL) FindWithdrawals ¶
func (repo RepoPostgreSQL) FindWithdrawals(ctx context.Context, client models.Client) (withdrawals []models.Withdrawal, err error)
func (RepoPostgreSQL) SaveClient ¶
func (RepoPostgreSQL) SaveWithdrawal ¶
func (repo RepoPostgreSQL) SaveWithdrawal(ctx context.Context, withdrawal *models.Withdrawal) (err error)
Click to show internal directories.
Click to hide internal directories.