Documentation ¶
Index ¶
- Constants
- Variables
- func APIValueTypeForGoType(t string) string
- func ApplyNodeTableOps(g *incr.Graph, n incr.INode, ops ...types.TableOp) error
- func CastAny(input, output any) error
- func CastValue[Output any](input any) (output Output, err error)
- func GetNodeValue(n incr.INode) any
- func LabelOrID(n incr.INode) string
- func LinkNodes(child incr.INode, inputs ...incr.INode) error
- func ParseTime(input string) (output time.Time, err error)
- func SetNodeValueDuringDeserialization(n incr.INode, value any) error
- func SetNodeValueOnline(n incr.INode, value any) error
- func UnlinkNodes(child incr.INode, inputs ...incr.INode)
- func ValueTypeIsMath(typeName string) bool
- type AlwaysIncr
- type Cutoff2ContextFunc
- type Cutoff2Func
- type Cutoff2Incr
- type CutoffIncr
- type FuncIncr
- type Funcfn
- type IAddInput
- type IInputs
- type IRawFunction
- type IRawValue
- type IRemoveInput
- type IRemoveInputByID
- type IRemoveInputByNodeID
- type ISetInput
- type ISetRawFunction
- type ISetRawValue
- type ISetRawVarValue
- type Inputs
- type Map2Func
- type Map2Incr
- type Map2NFunc
- type Map2NIncr
- type Map3Func
- type Map3Incr
- type MapFunc
- type MapIncr
- type MapNFunc
- type MapNIncr
- type ObserveIncr
- type VarIncr
Constants ¶
const ( NodeTypeVar = "var" NodeTypeTable = "table" NodeTypeObserver = "observer" NodeTypeCutoffExpression = "cutoff_expression" NodeTypeCutoffEpsilon = "cutoff_epsilon" NodeTypeCutoffUnchanged = "cutoff_unchanged" NodeTypeExpression = "expression" NodeTypeFilterTableExpression = "filter_table_expression" NodeTypeAlways = "always" NodeTypeFetchCSV = "fetch_csv" NodeTypeFetchJSON = "fetch_json" NodeTypeTimeseriesChart = "timeseries_chart" NodeTypeScatterChart = "scatter_chart" NodeTypeCurrentTimestamp = "current_timestamp" NodeTypeCast = "cast" NodeTypeFirst = "first" NodeTypeIndex = "index" NodeTypeLast = "last" NodeTypeLength = "length" NodeTypeMax = "max" NodeTypeMean = "mean" NodeTypeMedian = "median" NodeTypeMedianSorted = "median_sorted" NodeTypeMerge = "merge" NodeTypeMin = "min" NodeTypePercentile = "percentile" NodeTypePercentileSorted = "percentile_sorted" NodeTypeReverse = "reverse" NodeTypeSort = "sort" NodeTypeSum = "sum" NodeTypeTableColumn = "table_column" )
const ( ValueTypeBool = "bool" ValueTypeInt64 = "int64" ValueTypeFloat64 = "float64" ValueTypeString = "string" ValueTypeTimestamp = "time.Time" ValueTypeDuration = "time.Duration" )
const TimeFormatRFC3339Esque = "2006-01-02T15:04:05.999999999"
const TimeFormatYearTime = "2006-01-02 15:04"
Variables ¶
var ValueArrayTypes = iter.Apply(ValueScalarTypes, func(v string) string {
return "[]" + v
})
ValueArrayTypes are the scalar types as arrays, basically.
var ValueScalarTypes = []string{ ValueTypeBool, ValueTypeInt64, ValueTypeFloat64, ValueTypeString, ValueTypeTimestamp, ValueTypeDuration, }
ValueScalarTypes are the integral non-array types.
This list is used, for example, by `nodegen` to generate generic type parameters for functions. They need to be go types for this reason, but we can translate them to the abstracted api types separately.
var ValueTypeAny = "any"
ValueTypeAny is a special type that can be any value.
It is only used, really, for expressions.
var ValueTypeAnyArray = "[]any"
ValueTypeAnyArray is a special type that can be any value.
It is only used, really, for expressions.
var ValueTypeSVG = "types.SVG"
ValueTypeSVG is a special type that can hold an svg.
var ValueTypeTable = "*types.Table"
ValueTypeTable is a special type that can hold rows and columns of data.
var ValueTypes = append(ValueScalarTypes, ValueArrayTypes...)
ValueTypes are all the legal values types we can use as inputs or outputs for nodes.
var ValueTypesFull = append(ValueTypes, ValueTypeTable, ValueTypeSVG, ValueTypeAny, ValueTypeAnyArray)
ValueTypesFull are all the legal value types we can use as inputs and outputs for nodes including the table and svg types.
Functions ¶
func APIValueTypeForGoType ¶
APIValueTypeForGoType is the api type for a given go value type.
func ApplyNodeTableOps ¶
ApplyNodeTableOps applies node table operations.
This is only valid for incr types of table.
func LabelOrID ¶
func LabelOrID(n incr.INode) string
LabelOrID returns either the node's label or it's short id.
func LinkNodes ¶
func LinkNodes(child incr.INode, inputs ...incr.INode) error
LinkNodes adds inputs to a given child, associating the two nodes in the graph.
func SetNodeValueDuringDeserialization ¶
SetNodeValueDuringDeserialization sets the underlying value for the node but does _not_ mark the node as stale if it's a var!
func SetNodeValueOnline ¶
SetNodeValueOnline calls set on a given node with the appropriate type.
If the node is a var node, it will be marked as stale.
func UnlinkNodes ¶
func UnlinkNodes(child incr.INode, inputs ...incr.INode)
Unlink nodes removes the metadata association between two nodes but does _not_ remove node type specific input tracking.
func ValueTypeIsMath ¶
ValueTypeIsMath returns if a given value type is operatable.
Types ¶
type AlwaysIncr ¶
type AlwaysIncr[A any] interface { incr.AlwaysIncr[A] ISetInput IRemoveInput IInputs }
AlwaysIncr is an incremental that implements the always interface.
func Always ¶
func Always[A any](scope incr.Scope) AlwaysIncr[A]
Always yields an incremental that is always stale.
The way to use this effectively is to place this node above a tree of nodes that should always be recomputed, but specifically you'll likely want to pair this with a cutoff _below_ the immediate child of the always node such that you don't just always recompute an entire subgraph.
type Cutoff2ContextFunc ¶
Cutoff2ContextFunc is a function that implements cutoff checking and takes a context.
type Cutoff2Func ¶
Cutoff2Func is a function that implements cutoff checking.
type Cutoff2Incr ¶
type Cutoff2Incr[A, B any] interface { incr.Incr[B] incr.IStabilize incr.ICutoff ISetInput IRemoveInput IInputs IRawValue ISetRawValue IRawFunction ISetRawFunction }
CutoffIncr is an incremental node that implements the ICutoff interface.
func Cutoff2 ¶
func Cutoff2[A, B any](scope incr.Scope, fn Cutoff2Func[A, B]) Cutoff2Incr[A, B]
Cutoff returns a new wrapping cutoff incremental.
The goal of the cutoff incremental is to stop recomputation at a given node if the difference between the previous and latest values are not significant enough to warrant a full recomputation of the children of this node.
func Cutoff2Context ¶
func Cutoff2Context[A, B any](scope incr.Scope, fn Cutoff2ContextFunc[A, B]) Cutoff2Incr[A, B]
CutoffContext returns a new wrapping cutoff incremental.
The goal of the cutoff incremental is to stop recomputation at a given node if the difference between the previous and latest values are not significant enough to warrant a full recomputation of the children of this node.
type CutoffIncr ¶
type CutoffIncr[A any] interface { incr.Incr[A] incr.IStabilize incr.ICutoff IInputs ISetInput IRemoveInput IRawValue ISetRawValue IRawFunction ISetRawFunction }
CutoffIncr is an incremental node that implements the ICutoff interface.
func Cutoff ¶
func Cutoff[A any](scope incr.Scope, fn incr.CutoffFunc[A]) CutoffIncr[A]
Cutoff returns a new wrapping cutoff incremental.
The goal of the cutoff incremental is to stop recomputation at a given node if the difference between the previous and latest values are not significant enough to warrant a full recomputation of the children of this node.
func CutoffContext ¶
func CutoffContext[A any](scope incr.Scope, fn incr.CutoffContextFunc[A]) CutoffIncr[A]
CutoffContext returns a new wrapping cutoff incremental.
The goal of the cutoff incremental is to stop recomputation at a given node if the difference between the previous and latest values are not significant enough to warrant a full recomputation of the children of this node.
type IAddInput ¶
type IAddInput interface {
AddInput(incr.INode) error
}
IAddInput is an interface that allows nodes to add nodes without an associated name, e.g. for MapN.
type IInputs ¶
type IInputs interface {
Inputs() map[string]incr.INode
}
IInputs is an interface types can implement to get node inputs.
type IRawFunction ¶
type IRawFunction interface {
RawFunction() any
}
IRawFunction is an interface for getting the raw function.
type IRawValue ¶
type IRawValue interface {
RawValue() any
}
IRawValue is an interface for just the remove input function.
type IRemoveInput ¶
IRemoveInput is an interface that allows nodes to remove an input by an associated name.
type IRemoveInputByID ¶
type IRemoveInputByID interface {
RemoveInputByID(incr.Identifier) error
}
IRemoveInputByID is an interface that allows nodes to remove an input by parent node id.
type IRemoveInputByNodeID ¶
type IRemoveInputByNodeID interface {
RemoveInputByNodeID(incr.Identifier)
}
IRemoveInputByID is an interface for just the remove input function.
type ISetInput ¶
type ISetInput interface {
SetInput(inputName string, inputNode incr.INode, isDeserialize bool) error
}
ISetInput is an interface for just the add untyped input function.
type ISetRawFunction ¶
ISetRawFunction is an interface for setting the raw function.
type ISetRawValue ¶
ISetRawValue is an interface for just the add untyped input function.
type ISetRawVarValue ¶
ISetRawVarValue is an interface for just the add untyped input function.
type Inputs ¶
type Inputs[A any] struct { // contains filtered or unexported fields }
Inputs is a helper type to organize inputs to nodes for common functions like expressions.
func (Inputs[A]) ByIndex ¶
ByIndex gets the input by index e.g. when it was added to the inputs list.
func (Inputs[A]) ByNodeLabel ¶
ByNodeLabel returns the input by the label of the node it was sourced from.
type Map2Incr ¶
type Map2Incr[A, B, C any] interface { incr.Incr[C] ISetInput IRemoveInput IInputs IRawFunction ISetRawFunction IRawValue ISetRawValue }
MapNIncr is a type of incremental that can add inputs over time.
type Map2NIncr ¶
type Map2NIncr[A, B, C any] interface { incr.Incr[C] IInputs ISetInput IRemoveInputByID IRawValue ISetRawValue IRawFunction ISetRawFunction }
MapNIncr is a type of incremental that can add inputs over time.
type Map3Incr ¶
type Map3Incr[A, B, C, D any] interface { incr.Incr[D] ISetInput IRemoveInput IInputs IRawFunction ISetRawFunction IRawValue ISetRawValue }
MapNIncr is a type of incremental that can add inputs over time.
type MapIncr ¶
type MapIncr[A, B any] interface { incr.Incr[B] ISetInput IRemoveInput IInputs IRawValue ISetRawValue IRawFunction ISetRawFunction AddInput(incr.Incr[A]) }
MapNIncr is a type of incremental that can add inputs over time.
type MapNIncr ¶
type MapNIncr[A, B any] interface { incr.Incr[B] IInputs IAddInput IRemoveInputByID IRawValue ISetRawValue IRawFunction ISetRawFunction }
MapNIncr is a type of incremental that can add inputs over time.
type ObserveIncr ¶
type ObserveIncr[A any] interface { incr.Incr[A] fmt.Stringer ISetInput IRemoveInput IInputs IRawValue ISetRawValue incr.IObserver }
ObserveIncr is a type that implements the observer.
func Observe ¶
func Observe[A any](graph *incr.Graph) ObserveIncr[A]
Observe returns a observe increment.