ormu

package
v0.1.33 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2025 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BtStatusInit = iota + 1
	BtStatusRunning
	BtStatusDone
	BtStatusFail
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AddTaskParams

type AddTaskParams struct {
	Mode        string  `json:"mode"`
	Args        string  `json:"args"`
	Config      string  `json:"config"`
	Path        string  `json:"path"`
	Strats      string  `json:"strats"`
	Periods     string  `json:"periods"`
	Pairs       string  `json:"pairs"`
	CreateAt    int64   `json:"createAt"`
	StartAt     int64   `json:"startAt"`
	StopAt      int64   `json:"stopAt"`
	Status      int64   `json:"status"`
	Progress    float64 `json:"progress"`
	OrderNum    int64   `json:"orderNum"`
	ProfitRate  float64 `json:"profitRate"`
	WinRate     float64 `json:"winRate"`
	MaxDrawdown float64 `json:"maxDrawdown"`
	Sharpe      float64 `json:"sharpe"`
	Info        string  `json:"info"`
}

type DBTX

type DBTX interface {
	ExecContext(context.Context, string, ...interface{}) (sql.Result, error)
	PrepareContext(context.Context, string) (*sql.Stmt, error)
	QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error)
	QueryRowContext(context.Context, string, ...interface{}) *sql.Row
}

type FindTasksParams

type FindTasksParams struct {
	Mode     string `json:"mode"`     // 可选的模式筛选
	Path     string `json:"path"`     // 可选的路径筛选
	Status   int64  `json:"status"`   // 可选的状态筛选
	Strat    string `json:"strat"`    // 可选的策略筛选(模糊匹配)
	Period   string `json:"period"`   // 可选的周期筛选(模糊匹配)
	StartAt  int64  `json:"startAt"`  // 可选的开始时间精确匹配
	StopAt   int64  `json:"stopAt"`   // 可选的结束时间精确匹配
	MinStart int64  `json:"minStart"` // 可选的最小开始时间
	MaxStart int64  `json:"maxStart"` // 可选的最大开始时间
	MaxID    int64  `json:"maxId"`    // 可选的最大ID筛选
	Limit    int64  `json:"limit"`    // 限制返回数量
}

type GetTaskOptionsRow

type GetTaskOptionsRow struct {
	Strats  string `json:"strats"`
	Periods string `json:"periods"`
	StartAt int64  `json:"startAt"`
	StopAt  int64  `json:"stopAt"`
}

type Querier

type Querier interface {
	AddTask(ctx context.Context, arg AddTaskParams) (*Task, error)
	DelTasks(ctx context.Context, ids []int64) error
	GetTask(ctx context.Context, id int64) (*Task, error)
	GetTaskOptions(ctx context.Context) ([]*GetTaskOptionsRow, error)
	SetTaskPath(ctx context.Context, arg SetTaskPathParams) error
	UpdateTask(ctx context.Context, arg UpdateTaskParams) error
}

type Queries

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

func Conn

func Conn() (*Queries, *sql.DB, *errs.Error)

func New

func New(db DBTX) *Queries

func (*Queries) AddTask

func (q *Queries) AddTask(ctx context.Context, arg AddTaskParams) (*Task, error)

func (*Queries) DelTasks

func (q *Queries) DelTasks(ctx context.Context, ids []int64) error

func (*Queries) FindTasks

func (q *Queries) FindTasks(ctx context.Context, arg FindTasksParams) ([]*Task, *errs.Error)

func (*Queries) GetTask

func (q *Queries) GetTask(ctx context.Context, id int64) (*Task, error)

func (*Queries) GetTaskOptions

func (q *Queries) GetTaskOptions(ctx context.Context) ([]*GetTaskOptionsRow, error)

func (*Queries) SetTaskPath

func (q *Queries) SetTaskPath(ctx context.Context, arg SetTaskPathParams) error

func (*Queries) UpdateTask

func (q *Queries) UpdateTask(ctx context.Context, arg UpdateTaskParams) error

func (*Queries) WithTx

func (q *Queries) WithTx(tx *sql.Tx) *Queries

type SetTaskPathParams

type SetTaskPathParams struct {
	Path string `json:"path"`
	ID   int64  `json:"id"`
}

type Task

type Task struct {
	ID          int64   `json:"id"`
	Mode        string  `json:"mode"`
	Args        string  `json:"args"`
	Config      string  `json:"config"`
	Path        string  `json:"path"`
	Strats      string  `json:"strats"`
	Periods     string  `json:"periods"`
	Pairs       string  `json:"pairs"`
	CreateAt    int64   `json:"createAt"`
	StartAt     int64   `json:"startAt"`
	StopAt      int64   `json:"stopAt"`
	Status      int64   `json:"status"`
	Progress    float64 `json:"progress"`
	OrderNum    int64   `json:"orderNum"`
	ProfitRate  float64 `json:"profitRate"`
	WinRate     float64 `json:"winRate"`
	MaxDrawdown float64 `json:"maxDrawdown"`
	Sharpe      float64 `json:"sharpe"`
	Info        string  `json:"info"`
}

func (*Task) ToMap

func (t *Task) ToMap() map[string]interface{}

type UpdateTaskParams

type UpdateTaskParams struct {
	Status      int64   `json:"status"`
	Progress    float64 `json:"progress"`
	OrderNum    int64   `json:"orderNum"`
	ProfitRate  float64 `json:"profitRate"`
	WinRate     float64 `json:"winRate"`
	MaxDrawdown float64 `json:"maxDrawdown"`
	Sharpe      float64 `json:"sharpe"`
	Info        string  `json:"info"`
	ID          int64   `json:"id"`
}

Jump to

Keyboard shortcuts

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