engine

package
v0.0.0-...-74f9a32 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BaseTypeString  = "string"
	BaseTypeInteger = "integer"
	BaseTypeBoolean = "boolean"
	BaseTypeDecimal = "decimal"
	BaseTypeTime    = "time"
	BaseTypeNumeric = "numeric"
)

Variables

View Source
var ErrOptionArgNotExist = errors.New("argument is not exist")
View Source
var ErrOptionBadType = errors.New("value is bad type")
View Source
var ErrOptionVarNotExist = errors.New("variable is not exist")

Functions

This section is empty.

Types

type Argument

type Argument struct {
	Id           string
	Name         string
	Desc         string
	BaseType     string
	ExtendedType string
	Required     bool
	Value        interface{}
}

func (*Argument) CheckInputBaseType

func (a *Argument) CheckInputBaseType(inputBaseType string) bool

type Options

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

func NewOptions

func NewOptions(arguments []*Argument, varIdx map[string]interface{}) *Options

func (*Options) GetBoolean

func (o *Options) GetBoolean(key string) (bool, error)

func (*Options) GetDecimal

func (o *Options) GetDecimal(key string) (decimal.Decimal, error)

func (*Options) GetInteger

func (o *Options) GetInteger(key string) (int64, error)

func (*Options) GetNumericDecimal

func (o *Options) GetNumericDecimal(key string) (decimal.Decimal, error)

func (*Options) GetString

func (o *Options) GetString(key string) (string, error)

type SetArgument

type SetArgument struct {
	Id    string
	Value interface{}
}

type SetStackFunc

type SetStackFunc struct {
	Name      string
	Arguments []*SetArgument
}

type SetStackItem

type SetStackItem struct {
	Variable  string
	StackFunc *SetStackFunc
}

type Stack

type Stack struct {
	Id    string
	Name  string
	Items []*StackItem
}

Stack Стек операций.

func NewStack

func NewStack(name string) *Stack

type StackFunc

type StackFunc struct {
	Name      string
	Arguments []*Argument
	BaseType  string
}

func (*StackFunc) GetArgument

func (s *StackFunc) GetArgument(id string) *Argument

func (*StackFunc) SetArgument

func (s *StackFunc) SetArgument(id string, value interface{}) error

type StackFuncRepository

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

func NewStackFuncRepository

func NewStackFuncRepository() *StackFuncRepository

func (*StackFuncRepository) Get

func (*StackFuncRepository) GetAll

func (s *StackFuncRepository) GetAll() []StackFuncRun

func (*StackFuncRepository) GetAllDeclaration

func (s *StackFuncRepository) GetAllDeclaration() []*StackFunc

func (*StackFuncRepository) GetDeclaration

func (s *StackFuncRepository) GetDeclaration(name string) *StackFunc

func (*StackFuncRepository) Register

func (s *StackFuncRepository) Register(sf StackFuncRun)

type StackFuncRun

type StackFuncRun interface {
	Name() string
	BaseType() string
	Run(options *Options, now time.Time, accountId string, isTest bool) (interface{}, error)
	Arguments() []*Argument
}

StackFuncRun Функция элемента стека для выполнения.

type StackItem

type StackItem struct {
	Variable  string
	StackFunc *StackFunc
}

type StackManager

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

StackManager Менеджер управления стеками.

func NewStackManager

func NewStackManager(sfr *StackFuncRepository) *StackManager

func (*StackManager) Create

func (s *StackManager) Create(name string) *Stack

func (*StackManager) Delete

func (s *StackManager) Delete(id string)

func (*StackManager) FuncArgumentVarList

func (s *StackManager) FuncArgumentVarList(stackId, itemVariable, argumentId string) []string

func (*StackManager) Get

func (s *StackManager) Get(id string) *Stack

func (*StackManager) GetAll

func (s *StackManager) GetAll() []*Stack

func (*StackManager) Update

func (s *StackManager) Update(id, name string, setItems []*SetStackItem) (*Stack, error)

type StrategyContext

type StrategyContext struct {
	Strategy  *domain.Strategy
	LastRun   time.Time
	Logs      []*domain.StrategyLog
	IsRunning bool
}

func (*StrategyContext) AllowRun

func (s *StrategyContext) AllowRun(now time.Time) bool

func (*StrategyContext) WriteErrorLog

func (s *StrategyContext) WriteErrorLog(text string)

func (*StrategyContext) WriteStartLog

func (s *StrategyContext) WriteStartLog()

type StrategyEngine

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

StrategyEngine Движок исполнения стратегий.

func NewStrategyEngine

func NewStrategyEngine(sm *StackManager, sfr *StackFuncRepository, logger *zap.Logger) *StrategyEngine

func (*StrategyEngine) Create

func (s *StrategyEngine) Create() *domain.Strategy

func (*StrategyEngine) Delete

func (s *StrategyEngine) Delete(id string)

func (*StrategyEngine) Get

func (s *StrategyEngine) Get(id string) *domain.Strategy

func (*StrategyEngine) GetAll

func (s *StrategyEngine) GetAll() []*domain.Strategy

func (*StrategyEngine) GetLogs

func (s *StrategyEngine) GetLogs(id string) []*domain.StrategyLog

func (*StrategyEngine) Run

func (s *StrategyEngine) Run()

func (*StrategyEngine) Update

func (s *StrategyEngine) Update(strategy *domain.Strategy) error

type TestItemResult

type TestItemResult struct {
	Variable string
	Result   interface{}
	BaseType string
	Error    string
}

type TestStack

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

TestStack Движок тестирования стека.

func NewTestStack

func NewTestStack(sm *StackManager, sfr *StackFuncRepository) *TestStack

func (*TestStack) Test

func (t *TestStack) Test(stackId string, now time.Time, accountId string) ([]*TestItemResult, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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