pgx

package
v0.0.0-...-46f0560 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Auth

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

func NewAuth

func NewAuth(pg *database.Postgres) *Auth

func (*Auth) GetUserId

func (a *Auth) GetUserId(ctx context.Context, token string) (int, error)

func (*Auth) SetToken

func (a *Auth) SetToken(ctx context.Context, id int) (token string, err error)

type Buy

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

func NewBuy

func NewBuy(pg *database.Postgres) *Buy

func (*Buy) Create

func (b *Buy) Create(ctx context.Context, userId, companyId int, price int) (model.Buy, error)

func (*Buy) Delete

func (b *Buy) Delete(ctx context.Context, id int) (model.Buy, error)

func (*Buy) DeleteExpired

func (b *Buy) DeleteExpired(ctx context.Context) (id []model.BidInfo, err error)

func (*Buy) Get

func (b *Buy) Get(ctx context.Context, id int) (model.Buy, error)

func (*Buy) GetAllBuys

func (b *Buy) GetAllBuys(ctx context.Context, companyId int, limit, offset uint64) (price []int, err error)

func (*Buy) GetBuys

func (b *Buy) GetBuys(ctx context.Context, companyId int, minPrice int, limit uint64) (id []int, err error)

type Company

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

func NewCompany

func NewCompany(pg *database.Postgres) *Company

func (*Company) GetAll

func (c *Company) GetAll(ctx context.Context) ([]model.Company, error)

type Operation

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

func NewOperation

func NewOperation(pg *database.Postgres) *Operation

func (*Operation) Create

func (o *Operation) Create(ctx context.Context, buyerId, sellerId, companyId int, price int) error

type Portfolio

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

func NewPortfolio

func NewPortfolio(pg *database.Postgres) *Portfolio

func (*Portfolio) AddStock

func (p *Portfolio) AddStock(ctx context.Context, userId, companyId int) error

func (*Portfolio) Create

func (p *Portfolio) Create(ctx context.Context, userId, companyId int, count int) error

func (*Portfolio) Get

func (p *Portfolio) Get(ctx context.Context, userId int) ([]model.Asset, error)

func (*Portfolio) RemoveStock

func (p *Portfolio) RemoveStock(ctx context.Context, userId, companyId int) error

type Sale

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

func NewSale

func NewSale(pg *database.Postgres) *Sale

func (*Sale) Create

func (s *Sale) Create(ctx context.Context, userId, companyId int, price int) (model.Sale, error)

func (*Sale) Delete

func (s *Sale) Delete(ctx context.Context, id int) (model.Sale, error)

func (*Sale) DeleteExpired

func (s *Sale) DeleteExpired(ctx context.Context) (id []model.BidInfo, err error)

func (*Sale) Get

func (s *Sale) Get(ctx context.Context, id int) (model.Sale, error)

func (*Sale) GetAllSales

func (s *Sale) GetAllSales(ctx context.Context, companyId int, limit, offset uint64) (price []int, err error)

func (*Sale) GetSales

func (s *Sale) GetSales(ctx context.Context, companyId int, maxPrice int, limit uint64) (id []int, err error)

type User

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

func NewUser

func NewUser(pg *database.Postgres) *User

func (*User) Create

func (u *User) Create(ctx context.Context, login string, wealth int) (id int, err error)

func (*User) Get

func (u *User) Get(ctx context.Context, id int) (model.User, error)

func (*User) TopUp

func (u *User) TopUp(ctx context.Context, id int, wealth int) error

func (*User) Withdraw

func (u *User) Withdraw(ctx context.Context, id int, wealth int) error

Jump to

Keyboard shortcuts

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