sqlc

package
v0.0.0-...-3014034 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsRecordNotFoundError

func IsRecordNotFoundError(err error) bool

Types

type Connection

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

func NewConnection

func NewConnection(pool *pgxpool.Pool) *Connection

type DuplicatedEventError

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

func (*DuplicatedEventError) Error

func (e *DuplicatedEventError) Error() string

type DuplicatedRecordError

type DuplicatedRecordError string

func (DuplicatedRecordError) Error

func (e DuplicatedRecordError) Error() string

type NotEnoughBalanceError

type NotEnoughBalanceError struct {
	Err error
}

func (*NotEnoughBalanceError) Error

func (e *NotEnoughBalanceError) Error() string

func (*NotEnoughBalanceError) Unwrap

func (e *NotEnoughBalanceError) Unwrap() error

type Option

type Option func(*Repo)

func WithReplica

func WithReplica(pool *pgxpool.Pool) Option

WithReplica flexibility to choose whether to have slave pool Can be optimized to pass in multiple pools, if needed later

type RecordNotFoundError

type RecordNotFoundError struct {
	Err error
}

func (*RecordNotFoundError) Error

func (e *RecordNotFoundError) Error() string

func (*RecordNotFoundError) Unwrap

func (e *RecordNotFoundError) Unwrap() error

type Repo

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

func NewSqlcRepository

func NewSqlcRepository(pool *pgxpool.Pool, logger *zerolog.Logger, opts ...Option) *Repo

func (*Repo) BatchUpsertDailyClose

func (repo *Repo) BatchUpsertDailyClose(
	ctx context.Context,
	objs []*domain.DailyClose,
) error

func (*Repo) BatchUpsertStakeConcentration

func (repo *Repo) BatchUpsertStakeConcentration(
	ctx context.Context,
	objs []*domain.StakeConcentration,
) error

func (*Repo) BatchUpsertStocks

func (repo *Repo) BatchUpsertStocks(
	ctx context.Context,
	objs []*domain.Stock,
) error

func (*Repo) BatchUpsertThreePrimary

func (repo *Repo) BatchUpsertThreePrimary(
	ctx context.Context,
	objs []*domain.ThreePrimary,
) error

func (*Repo) CreateDailyClose

func (repo *Repo) CreateDailyClose(
	ctx context.Context,
	obj *domain.DailyClose,
) error

func (*Repo) CreateOrder

func (repo *Repo) CreateOrder(
	ctx context.Context,
	orders []*domain.Order,
	transactions []*domain.Transaction,
) error

func (*Repo) CreatePickedStocks

func (repo *Repo) CreatePickedStocks(ctx context.Context, objs []*domain.PickedStock) error

func (*Repo) CreateStock

func (repo *Repo) CreateStock(
	ctx context.Context,
	obj *domain.Stock,
) error

func (*Repo) CreateThreePrimary

func (repo *Repo) CreateThreePrimary(
	ctx context.Context,
	arg *domain.ThreePrimary,
) error

func (*Repo) CreateTransaction

func (repo *Repo) CreateTransaction(ctx context.Context, transaction *domain.Transaction) error

func (*Repo) CreateUser

func (repo *Repo) CreateUser(ctx context.Context, obj *domain.User) error

func (*Repo) DeletePickedStock

func (repo *Repo) DeletePickedStock(
	ctx context.Context,
	userID uuid.UUID,
	stockID string,
) error

func (*Repo) DeleteSessionID

func (repo *Repo) DeleteSessionID(ctx context.Context, userID uuid.UUID) error

func (*Repo) DeleteStockByID

func (repo *Repo) DeleteStockByID(
	ctx context.Context,
	id string,
) error

func (*Repo) DeleteUserByID

func (repo *Repo) DeleteUserByID(ctx context.Context, userID uuid.UUID) error

func (*Repo) GetBalanceView

func (repo *Repo) GetBalanceView(ctx context.Context, id uuid.UUID) (*domain.BalanceView, error)

func (*Repo) GetHighestPrice

func (repo *Repo) GetHighestPrice(
	ctx context.Context,
	stockIDs []string,
	date string,
	rewindWeek int,
) (map[string]float32, error)

func (*Repo) GetRealTimeMonitoringKeys

func (repo *Repo) GetRealTimeMonitoringKeys(ctx context.Context) ([]string, error)

func (*Repo) GetStakeConcentrationByStockID

func (repo *Repo) GetStakeConcentrationByStockID(
	ctx context.Context,
	stockID,
	date string,
) (*domain.StakeConcentration, error)

func (*Repo) GetStakeConcentrationLatestDataPoint

func (repo *Repo) GetStakeConcentrationLatestDataPoint(
	ctx context.Context,
) string

func (*Repo) GetStakeConcentrationsWithVolumes

func (repo *Repo) GetStakeConcentrationsWithVolumes(
	ctx context.Context,
	stockID, date string,
) ([]*domain.CalculationBase, error)

func (*Repo) GetUserByEmail

func (repo *Repo) GetUserByEmail(ctx context.Context, email string) (*domain.User, error)

func (*Repo) GetUserByID

func (repo *Repo) GetUserByID(ctx context.Context, userID uuid.UUID) (*domain.User, error)

func (*Repo) GetUserByPhone

func (repo *Repo) GetUserByPhone(ctx context.Context, phone string) (*domain.User, error)

func (*Repo) HasDailyClose

func (repo *Repo) HasDailyClose(ctx context.Context, date string) (bool, error)

func (*Repo) HasStakeConcentration

func (repo *Repo) HasStakeConcentration(ctx context.Context, exchangeDate string) (bool, error)

func (*Repo) LatestStockStatSnapshot

func (repo *Repo) LatestStockStatSnapshot(ctx context.Context) ([]*domain.Selection, error)

func (*Repo) ListCategories

func (repo *Repo) ListCategories(ctx context.Context) ([]string, error)

func (*Repo) ListDailyClose

func (repo *Repo) ListDailyClose(
	ctx context.Context,
	arg *domain.ListDailyCloseParams,
) ([]*domain.DailyClose, error)

func (*Repo) ListLatestPrice

func (repo *Repo) ListLatestPrice(
	ctx context.Context,
	stockIDs []string,
) ([]*domain.StockPrice, error)

func (*Repo) ListOpenOrders

func (repo *Repo) ListOpenOrders(
	ctx context.Context,
	userID uuid.UUID,
	stockID string,
	orderType string,
) ([]*domain.Order, error)

func (*Repo) ListOrders

func (repo *Repo) ListOrders(
	ctx context.Context,
	arg *domain.ListOrdersParams,
) ([]*domain.Order, error)

func (*Repo) ListPickedStocks

func (repo *Repo) ListPickedStocks(
	ctx context.Context,
	userID uuid.UUID,
) ([]domain.PickedStock, error)

func (*Repo) ListSelections

func (repo *Repo) ListSelections(
	ctx context.Context,
	date string,
	strict bool,
) ([]*domain.Selection, error)

func (*Repo) ListSelectionsFromPicked

func (repo *Repo) ListSelectionsFromPicked(
	ctx context.Context,
	stockIDs []string,
) ([]*domain.Selection, error)

func (*Repo) ListStocks

func (repo *Repo) ListStocks(
	ctx context.Context,
	arg *domain.ListStocksParams,
) ([]*domain.Stock, error)

func (*Repo) ListThreePrimary

func (repo *Repo) ListThreePrimary(
	ctx context.Context,
	arg *domain.ListThreePrimaryParams,
) ([]*domain.ThreePrimary, error)

func (*Repo) ListUsers

func (repo *Repo) ListUsers(
	ctx context.Context,
	limit int32,
	offset int32,
) ([]*domain.User, error)

func (*Repo) RetrieveDailyCloseHistory

func (repo *Repo) RetrieveDailyCloseHistory(
	ctx context.Context,
	stockIDs []string,
	opts ...string,
) ([]*domain.DailyClose, error)

func (*Repo) RetrieveThreePrimaryHistory

func (repo *Repo) RetrieveThreePrimaryHistory(
	ctx context.Context,
	stockIDs []string,
	opts ...string,
) ([]*domain.ThreePrimary, error)

func (*Repo) RunInTransaction

func (repo *Repo) RunInTransaction(ctx context.Context, fn func(context.Context) error) error

func (*Repo) Transaction

func (repo *Repo) Transaction(ctx context.Context) (*Trans, error)

func (*Repo) UpdateSessionID

func (repo *Repo) UpdateSessionID(ctx context.Context, params *domain.UpdateSessionIDParams) error

func (*Repo) UpdateUser

func (repo *Repo) UpdateUser(ctx context.Context, obj *domain.User) error

type Trans

type Trans struct {
	pgx.Tx
}

type TypeMismatchError

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

func (*TypeMismatchError) Error

func (tme *TypeMismatchError) Error() string

type UnexpectedNadexMemberStatusError

type UnexpectedNadexMemberStatusError string

func (UnexpectedNadexMemberStatusError) Error

type UnsupportedTradeTypeError

type UnsupportedTradeTypeError string

func (UnsupportedTradeTypeError) Error

Jump to

Keyboard shortcuts

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