postgres

package
v0.0.0-...-ab49fd9 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const ExecutionTable = `` /* 325-byte string literal not displayed */
View Source
const PeriodTable = `` /* 822-byte string literal not displayed */
View Source
const StrategyTable = `CREATE TABLE IF NOT EXISTS strategy (
name text PRIMARY KEY,
backtest text,
worker text);`

Variables

This section is empty.

Functions

func CreateConstraint

func CreateConstraint(ctx context.Context, db *pgxpool.Pool)

Ugly and silent way to add constraint. Will always fail if constraint exists

Types

type BacktestPostgres

type BacktestPostgres struct {
	Connection *pgxpool.Pool
}

func (*BacktestPostgres) Create

func (db *BacktestPostgres) Create(ctx context.Context, strategy string, backtest *storage.Backtest) error

func (*BacktestPostgres) Delete

func (db *BacktestPostgres) Delete(ctx context.Context, id string) error

func (*BacktestPostgres) Get

func (*BacktestPostgres) List

func (db *BacktestPostgres) List(ctx context.Context, strategy string) ([]*storage.Backtest, error)

func (*BacktestPostgres) ListByStage

func (db *BacktestPostgres) ListByStage(ctx context.Context, stages ...string) ([]*storage.Backtest, error)

func (*BacktestPostgres) Update

func (db *BacktestPostgres) Update(ctx context.Context, backtest *storage.Backtest) error

type PeriodPostgres

type PeriodPostgres struct {
	Connection *pgxpool.Pool
}

func (*PeriodPostgres) List

func (db *PeriodPostgres) List(ctx context.Context, backtestID string, offset int) ([]*storage.Period, error)

List Returns all results from a backtest

func (*PeriodPostgres) Store

func (db *PeriodPostgres) Store(ctx context.Context, backtest string, period *storage.Period) error

Create Adds a new entry to the result of a backtest

type StrategyPostgres

type StrategyPostgres struct {
	Connection *pgxpool.Pool
}

func (*StrategyPostgres) Create

func (db *StrategyPostgres) Create(ctx context.Context, strategy *storage.Strategy) error

func (*StrategyPostgres) Delete

func (db *StrategyPostgres) Delete(ctx context.Context, name string) error

func (*StrategyPostgres) Get

func (db *StrategyPostgres) Get(ctx context.Context, name string) (*storage.Strategy, error)

func (*StrategyPostgres) List

func (db *StrategyPostgres) List(ctx context.Context) ([]*storage.Strategy, error)

func (*StrategyPostgres) Update

func (db *StrategyPostgres) Update(ctx context.Context, strategy *storage.Strategy) error

Jump to

Keyboard shortcuts

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