sql

package
v0.10.2 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2023 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultGormConfig = &gorm.Config{
		Logger: logger.Default.LogMode(logger.Silent),
	}
)
View Source
var (
	ErrInvalidConfig = errors.New("invalid sql config")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	User     string
	Password string
	Host     string
	Port     int
	Database string
}

func (*Config) Load

func (c *Config) Load() *Config

func (Config) URL

func (c Config) URL() string

func (Config) Validate

func (c Config) Validate() error

type DB

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

func New

func New(c config.SQL) (*DB, error)

func (*DB) CreateBacktest

func (sqldb *DB) CreateBacktest(ctx context.Context, bt *backtest.Backtest) error

func (*DB) DeleteBacktest

func (sqldb *DB) DeleteBacktest(ctx context.Context, bt backtest.Backtest) error

func (*DB) LockedBacktest

func (sqldb *DB) LockedBacktest(ctx context.Context, id uint, fn db.LockedBacktestCallback) error

func (*DB) ReadBacktest

func (sqldb *DB) ReadBacktest(ctx context.Context, id uint) (backtest.Backtest, error)

func (*DB) Reset

func (d *DB) Reset() error

func (*DB) UpdateBacktest

func (sqldb *DB) UpdateBacktest(ctx context.Context, bt backtest.Backtest) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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