postgres

package
v0.0.0-...-fa05739 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Database

type Database struct {
	Pool *pgxpool.Pool
}

func Connect

func Connect(ctx context.Context, connString string) (*Database, error)

func (*Database) Close

func (db *Database) Close()

func (*Database) NewPostgresClient

func (db *Database) NewPostgresClient() *gaivota.Client

func (*Database) Ping

func (db *Database) Ping() (msg string, err error)

type HoldingStore

type HoldingStore struct {
	Database *Database
}

func NewHoldingStore

func NewHoldingStore(db *Database) *HoldingStore

func (*HoldingStore) Add

func (store *HoldingStore) Add(ctx context.Context, holding *gaivota.Holding) (*gaivota.Holding, error)

func (*HoldingStore) All

func (store *HoldingStore) All(ctx context.Context) (*[]gaivota.Holding, error)

func (*HoldingStore) Delete

func (store *HoldingStore) Delete(ctx context.Context, id int) error

func (*HoldingStore) Get

func (store *HoldingStore) Get(ctx context.Context, id int) (*gaivota.Holding, error)

func (*HoldingStore) GetByPositionID

func (store *HoldingStore) GetByPositionID(ctx context.Context, positionId int) (*[]gaivota.Holding, error)

func (*HoldingStore) GetByUserID

func (store *HoldingStore) GetByUserID(ctx context.Context, userId int) (*[]gaivota.Holding, error)

func (*HoldingStore) GetByWalletID

func (store *HoldingStore) GetByWalletID(ctx context.Context, walletId int) (*[]gaivota.Holding, error)

func (*HoldingStore) Update

func (store *HoldingStore) Update(ctx context.Context, holding *gaivota.Holding) error

type InvestmentStore

type InvestmentStore struct {
	Database *Database
}

func NewInvestmentStore

func NewInvestmentStore(db *Database) *InvestmentStore

func (*InvestmentStore) Add

func (store *InvestmentStore) Add(ctx context.Context, investment *gaivota.Investment) (*gaivota.Investment, error)

func (*InvestmentStore) All

func (store *InvestmentStore) All(ctx context.Context) (*[]gaivota.Investment, error)

func (*InvestmentStore) Delete

func (store *InvestmentStore) Delete(ctx context.Context, id int) error

func (*InvestmentStore) Get

func (store *InvestmentStore) Get(ctx context.Context, id int) (*gaivota.Investment, error)

func (*InvestmentStore) GetByPortfolioID

func (store *InvestmentStore) GetByPortfolioID(ctx context.Context, portfolioId int) (*[]gaivota.Investment, error)

func (*InvestmentStore) GetByUserID

func (store *InvestmentStore) GetByUserID(ctx context.Context, userId int) (*[]gaivota.Investment, error)

func (*InvestmentStore) Update

func (store *InvestmentStore) Update(ctx context.Context, investment *gaivota.Investment) error

type PortfolioStore

type PortfolioStore struct {
	Database *Database
}

func NewPortfolioStore

func NewPortfolioStore(db *Database) *PortfolioStore

func (*PortfolioStore) Add

func (store *PortfolioStore) Add(ctx context.Context, portfolio *gaivota.Portfolio) (*gaivota.Portfolio, error)

func (*PortfolioStore) All

func (store *PortfolioStore) All(ctx context.Context) (*[]gaivota.Portfolio, error)

func (*PortfolioStore) Delete

func (store *PortfolioStore) Delete(ctx context.Context, id int) error

func (*PortfolioStore) Get

func (store *PortfolioStore) Get(ctx context.Context, id int) (*gaivota.Portfolio, error)

func (*PortfolioStore) GetByUserID

func (store *PortfolioStore) GetByUserID(ctx context.Context, userId int) (*[]gaivota.Portfolio, error)

func (*PortfolioStore) Update

func (store *PortfolioStore) Update(ctx context.Context, portfolio *gaivota.Portfolio) error

type PositionStore

type PositionStore struct {
	Database *Database
}

func NewPositionStore

func NewPositionStore(db *Database) *PositionStore

func (*PositionStore) Add

func (store *PositionStore) Add(ctx context.Context, position *gaivota.Position) (*gaivota.Position, error)

func (*PositionStore) All

func (store *PositionStore) All(ctx context.Context) (*[]gaivota.Position, error)

func (*PositionStore) Delete

func (store *PositionStore) Delete(ctx context.Context, id int) error

func (*PositionStore) Get

func (store *PositionStore) Get(ctx context.Context, id int) (*gaivota.Position, error)

func (*PositionStore) GetByUserID

func (store *PositionStore) GetByUserID(ctx context.Context, userId int) (*gaivota.Position, error)

func (*PositionStore) Update

func (store *PositionStore) Update(ctx context.Context, position *gaivota.Position) error

type UserStore

type UserStore struct {
	Database *Database
}

func NewUserStore

func NewUserStore(db *Database) *UserStore

func (*UserStore) Add

func (store *UserStore) Add(ctx context.Context, user *gaivota.User) (*gaivota.User, error)

func (*UserStore) All

func (store *UserStore) All(ctx context.Context) (*[]gaivota.User, error)

func (*UserStore) Delete

func (store *UserStore) Delete(ctx context.Context, id int) error

func (*UserStore) Get

func (store *UserStore) Get(ctx context.Context, id int) (*gaivota.User, error)

func (*UserStore) Update

func (store *UserStore) Update(ctx context.Context, user *gaivota.User) error

type WalletStore

type WalletStore struct {
	Database *Database
}

func NewWalletStore

func NewWalletStore(db *Database) *WalletStore

func (*WalletStore) Add

func (store *WalletStore) Add(ctx context.Context, wallet *gaivota.Wallet) (*gaivota.Wallet, error)

func (*WalletStore) All

func (store *WalletStore) All(ctx context.Context) (*[]gaivota.Wallet, error)

func (*WalletStore) Delete

func (store *WalletStore) Delete(ctx context.Context, id int) error

func (*WalletStore) Get

func (store *WalletStore) Get(ctx context.Context, id int) (*gaivota.Wallet, error)

func (*WalletStore) GetByUserID

func (store *WalletStore) GetByUserID(ctx context.Context, userId int) (*[]gaivota.Wallet, error)

func (*WalletStore) Update

func (store *WalletStore) Update(ctx context.Context, wallet *gaivota.Wallet) error

Jump to

Keyboard shortcuts

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