blocks

package
v0.0.0-...-5d55e2f Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NameIn     = "in"
	NameLength = "length"
	NameOut    = "out"
	NamePeriod = "period"
	NameTrend  = "trend"
)
View Source
const (
	SchemaPeriod = `{
		"type": "integer",
		"minimum": 1,
		"maximum": 1000,
	}`
)
View Source
const (
	TypeFloat64 = "float64"
)

Variables

This section is empty.

Functions

func ClearOutputs

func ClearOutputs(blk Block)

Types

type Block

type Block interface {
	GetType() string
	GetDescription() string
	GetParams() Params
	GetInputs() Inputs
	GetOutputs() Outputs
	GetWarmupPeriod() int

	IsWarm() bool

	Init() error
	Update(*models.Bar)
}

type FltEnum

type FltEnum struct {
	Value, Default float64
	Enum           []float64
}

func (*FltEnum) GetDefault

func (p *FltEnum) GetDefault() any

func (*FltEnum) GetLimits

func (p *FltEnum) GetLimits() []any

func (*FltEnum) GetType

func (p *FltEnum) GetType() string

func (*FltEnum) GetVal

func (p *FltEnum) GetVal() any

func (*FltEnum) SetVal

func (p *FltEnum) SetVal(val any) error

type FltRange

type FltRange struct {
	Value, Min, Max, Default float64
}

func (*FltRange) GetDefault

func (p *FltRange) GetDefault() any

func (*FltRange) GetLimits

func (p *FltRange) GetLimits() []any

func (*FltRange) GetType

func (p *FltRange) GetType() string

func (*FltRange) GetVal

func (p *FltRange) GetVal() any

func (*FltRange) SetVal

func (p *FltRange) SetVal(val any) error

type Input

type Input interface {
	GetType() string

	IsAsynchronous() bool
	IsConnected() bool
	IsOptional() bool
	IsValueSet() bool

	Connect(Output) error
}

type Inputs

type Inputs map[string]Input

type IntEnum

type IntEnum struct {
	Value, Default int
	Enum           []int
}

func (*IntEnum) GetDefault

func (p *IntEnum) GetDefault() any

func (*IntEnum) GetLimits

func (p *IntEnum) GetLimits() []any

func (*IntEnum) GetType

func (p *IntEnum) GetType() string

func (*IntEnum) GetVal

func (p *IntEnum) GetVal() any

func (*IntEnum) SetVal

func (p *IntEnum) SetVal(val any) error

type IntRange

type IntRange struct {
	Value, Min, Max, Default int
}

func (*IntRange) GetDefault

func (p *IntRange) GetDefault() any

func (*IntRange) GetLimits

func (p *IntRange) GetLimits() []any

func (*IntRange) GetType

func (p *IntRange) GetType() string

func (*IntRange) GetVal

func (p *IntRange) GetVal() any

func (*IntRange) SetVal

func (p *IntRange) SetVal(val any) error

type Output

type Output interface {
	GetType() string
	GetConnected() []Input

	IsAsynchronous() bool
	IsConnected() bool
	ClearValue()
	IsValueSet() bool

	Connect(Input) error
	DisconnectAll()
}

type Outputs

type Outputs map[string]Output

type Param

type Param interface {
	GetType() string
	GetDefault() any
	GetLimits() []any
	GetVal() any
	SetVal(any) error
}

type ParamVals

type ParamVals map[string]any

type Params

type Params map[string]Param

func (Params) GetNonDefaultValues

func (ps Params) GetNonDefaultValues() ParamVals

func (Params) GetSortedNames

func (ps Params) GetSortedNames() []string

func (Params) SetValuesOrDefault

func (ps Params) SetValuesOrDefault(vals ParamVals) error

type Recorder

type Recorder interface {
	Init(valNames []string) error
	Process(map[string]models.TimeValue[float64])
}

type StringEnum

type StringEnum struct {
	Value, Default string
	Enum           []string
}

func (*StringEnum) GetDefault

func (p *StringEnum) GetDefault() any

func (*StringEnum) GetLimits

func (p *StringEnum) GetLimits() []any

func (*StringEnum) GetType

func (p *StringEnum) GetType() string

func (*StringEnum) GetVal

func (p *StringEnum) GetVal() any

func (*StringEnum) SetVal

func (p *StringEnum) SetVal(val any) error

type TypedInput

type TypedInput[T any] struct {
	Type     string
	Optional bool
	// contains filtered or unexported fields
}

func NewTypedInput

func NewTypedInput[T any]() *TypedInput[T]

func NewTypedInputOptional

func NewTypedInputOptional[T any]() *TypedInput[T]

func (*TypedInput[T]) Connect

func (in *TypedInput[T]) Connect(o Output) error

func (*TypedInput[T]) GetType

func (in *TypedInput[T]) GetType() string

func (*TypedInput[T]) GetValue

func (in *TypedInput[T]) GetValue() T

func (*TypedInput[T]) IsAsynchronous

func (in *TypedInput[T]) IsAsynchronous() bool

func (*TypedInput[T]) IsConnected

func (in *TypedInput[T]) IsConnected() bool

func (*TypedInput[T]) IsOptional

func (in *TypedInput[T]) IsOptional() bool

func (*TypedInput[T]) IsValueSet

func (in *TypedInput[T]) IsValueSet() bool

type TypedInputAsync

type TypedInputAsync[T any] struct {
	Type     string
	Optional bool
	// contains filtered or unexported fields
}

func NewTypedInputAsync

func NewTypedInputAsync[T any]() *TypedInputAsync[T]

func NewTypedInputAsyncOptional

func NewTypedInputAsyncOptional[T any]() *TypedInputAsync[T]

func (*TypedInputAsync[T]) Connect

func (in *TypedInputAsync[T]) Connect(o Output) error

func (*TypedInputAsync[T]) GetTime

func (in *TypedInputAsync[T]) GetTime() time.Time

func (*TypedInputAsync[T]) GetType

func (in *TypedInputAsync[T]) GetType() string

func (*TypedInputAsync[T]) GetValue

func (in *TypedInputAsync[T]) GetValue() T

func (*TypedInputAsync[T]) IsAsynchronous

func (in *TypedInputAsync[T]) IsAsynchronous() bool

func (*TypedInputAsync[T]) IsConnected

func (in *TypedInputAsync[T]) IsConnected() bool

func (*TypedInputAsync[T]) IsOptional

func (in *TypedInputAsync[T]) IsOptional() bool

func (*TypedInputAsync[T]) IsValueSet

func (in *TypedInputAsync[T]) IsValueSet() bool

type TypedOutput

type TypedOutput[T any] struct {
	Type string

	Ins []*TypedInput[T]
	// contains filtered or unexported fields
}

func NewTypedOutput

func NewTypedOutput[T any]() *TypedOutput[T]

func (*TypedOutput[T]) ClearValue

func (out *TypedOutput[T]) ClearValue()

func (*TypedOutput[T]) Connect

func (out *TypedOutput[T]) Connect(i Input) error

func (*TypedOutput[T]) DisconnectAll

func (out *TypedOutput[T]) DisconnectAll()

func (*TypedOutput[T]) GetConnected

func (out *TypedOutput[T]) GetConnected() []Input

func (*TypedOutput[T]) GetType

func (out *TypedOutput[T]) GetType() string

func (*TypedOutput[T]) GetValue

func (out *TypedOutput[T]) GetValue() T

func (*TypedOutput[T]) IsAsynchronous

func (out *TypedOutput[T]) IsAsynchronous() bool

func (*TypedOutput[T]) IsConnected

func (out *TypedOutput[T]) IsConnected() bool

func (*TypedOutput[T]) IsValueSet

func (out *TypedOutput[T]) IsValueSet() bool

func (*TypedOutput[T]) SetIfConnected

func (out *TypedOutput[T]) SetIfConnected(calcVal func() T)

func (*TypedOutput[T]) SetValue

func (out *TypedOutput[T]) SetValue(val T)

type TypedOutputAsync

type TypedOutputAsync[T any] struct {
	Type string

	Ins []*TypedInputAsync[T]
	// contains filtered or unexported fields
}

func NewTypedOutputAsync

func NewTypedOutputAsync[T any]() *TypedOutputAsync[T]

func (*TypedOutputAsync[T]) ClearValue

func (out *TypedOutputAsync[T]) ClearValue()

func (*TypedOutputAsync[T]) Connect

func (out *TypedOutputAsync[T]) Connect(i Input) error

func (*TypedOutputAsync[T]) DisconnectAll

func (out *TypedOutputAsync[T]) DisconnectAll()

func (*TypedOutputAsync[T]) GetConnected

func (out *TypedOutputAsync[T]) GetConnected() []Input

func (*TypedOutputAsync[T]) GetType

func (out *TypedOutputAsync[T]) GetType() string

func (*TypedOutputAsync[T]) GetValue

func (out *TypedOutputAsync[T]) GetValue() T

func (*TypedOutputAsync[T]) IsAsynchronous

func (out *TypedOutputAsync[T]) IsAsynchronous() bool

func (*TypedOutputAsync[T]) IsConnected

func (out *TypedOutputAsync[T]) IsConnected() bool

func (*TypedOutputAsync[T]) IsValueSet

func (out *TypedOutputAsync[T]) IsValueSet() bool

func (*TypedOutputAsync[T]) SetIfConnected

func (out *TypedOutputAsync[T]) SetIfConnected(t time.Time, calcVal func() T)

func (*TypedOutputAsync[T]) SetTimeValue

func (out *TypedOutputAsync[T]) SetTimeValue(t time.Time, val T)

Directories

Path Synopsis
Package mock_blocks is a generated GoMock package.
Package mock_blocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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