Documentation
¶
Index ¶
- Constants
- func FuncValueToConstFunc(fv *full.FuncValue) interfaces.Func
- func SimpleFnToConstFunc(name string, fv *types.FuncValue) interfaces.Func
- func SimpleFnToDirectFunc(name string, fv *types.FuncValue) interfaces.Func
- func SimpleFnToFuncValue(name string, fv *types.FuncValue) *full.FuncValue
- type CallFunc
- type ChannelBasedSinkFunc
- func (obj *ChannelBasedSinkFunc) ArgGen(index int) (string, error)
- func (obj *ChannelBasedSinkFunc) Info() *interfaces.Info
- func (obj *ChannelBasedSinkFunc) Init(init *interfaces.Init) error
- func (obj *ChannelBasedSinkFunc) Stream(ctx context.Context) error
- func (obj *ChannelBasedSinkFunc) String() string
- func (obj *ChannelBasedSinkFunc) Validate() error
- type ChannelBasedSourceFunc
- func (obj *ChannelBasedSourceFunc) ArgGen(index int) (string, error)
- func (obj *ChannelBasedSourceFunc) Info() *interfaces.Info
- func (obj *ChannelBasedSourceFunc) Init(init *interfaces.Init) error
- func (obj *ChannelBasedSourceFunc) Stream(ctx context.Context) error
- func (obj *ChannelBasedSourceFunc) String() string
- func (obj *ChannelBasedSourceFunc) Validate() error
- type CompositeFunc
- func (obj *CompositeFunc) Call(ctx context.Context, args []types.Value) (types.Value, error)
- func (obj *CompositeFunc) Info() *interfaces.Info
- func (obj *CompositeFunc) Init(init *interfaces.Init) error
- func (obj *CompositeFunc) Stream(ctx context.Context) error
- func (obj *CompositeFunc) String() string
- func (obj *CompositeFunc) StructCall(ctx context.Context, st types.Value) (types.Value, error)
- func (obj *CompositeFunc) Validate() error
- type ConstFunc
- func (obj *ConstFunc) Call(ctx context.Context, args []types.Value) (types.Value, error)
- func (obj *ConstFunc) Info() *interfaces.Info
- func (obj *ConstFunc) Init(init *interfaces.Init) error
- func (obj *ConstFunc) Stream(ctx context.Context) error
- func (obj *ConstFunc) String() string
- func (obj *ConstFunc) Validate() error
- type IfFunc
Constants ¶
const ( // CallFuncName is the unique name identifier for this function. CallFuncName = "call" // CallFuncArgNameFunction is the name for the edge which connects the // input function to CallFunc. CallFuncArgNameFunction = "fn" )
const ( // ChannelBasedSinkFuncArgName is the name for the edge which connects // the input value to ChannelBasedSinkFunc. ChannelBasedSinkFuncArgName = "channelBasedSinkFuncArg" )
const (
// CompositeFuncName is the unique name identifier for this function.
CompositeFuncName = "composite"
)
const (
// ConstFuncName is the unique name identifier for this function.
ConstFuncName = "const"
)
const (
// IfFuncName is the unique name identifier for this function.
IfFuncName = "if"
)
Variables ¶
This section is empty.
Functions ¶
func FuncValueToConstFunc ¶
func FuncValueToConstFunc(fv *full.FuncValue) interfaces.Func
FuncValueToConstFunc transforms a *full.FuncValue into an interfaces.Func which is implemented by &ConstFunc{}.
func SimpleFnToConstFunc ¶
func SimpleFnToConstFunc(name string, fv *types.FuncValue) interfaces.Func
SimpleFnToConstFunc transforms a name and *types.FuncValue into an interfaces.Func which is implemented by FuncValueToConstFunc and SimpleFnToFuncValue.
func SimpleFnToDirectFunc ¶
func SimpleFnToDirectFunc(name string, fv *types.FuncValue) interfaces.Func
SimpleFnToDirectFunc transforms a name and *types.FuncValue into an interfaces.Func which is implemented by &simple.WrappedFunc{}.
Types ¶
type CallFunc ¶
type CallFunc struct { Type *types.Type // the type of the result of applying the function FuncType *types.Type // the type of the function EdgeName string // name of the edge used ArgVertices []interfaces.Func // contains filtered or unexported fields }
CallFunc receives a function from upstream, but not the arguments. Instead, the Funcs which emit those arguments must be specified at construction time. The arguments are connected to the received FuncValues in such a way that CallFunc emits the result of applying the function to the arguments.
func (*CallFunc) Info ¶
func (obj *CallFunc) Info() *interfaces.Info
Info returns some static info about itself.
func (*CallFunc) Init ¶
func (obj *CallFunc) Init(init *interfaces.Init) error
Init runs some startup code for this composite function.
func (*CallFunc) Stream ¶
Stream takes an input struct in the format as described in the Func and Graph methods of the Expr, and returns the actual expected value as a stream based on the changing inputs to that value.
type ChannelBasedSinkFunc ¶
type ChannelBasedSinkFunc struct { Name string EdgeName string Target interfaces.Func // for drawing dashed edges in the Graphviz visualization Chan chan types.Value Type *types.Type // contains filtered or unexported fields }
ChannelBasedSinkFunc is a Func which receives values from upstream nodes and emits them to a golang channel.
func (*ChannelBasedSinkFunc) ArgGen ¶
func (obj *ChannelBasedSinkFunc) ArgGen(index int) (string, error)
ArgGen returns the Nth arg name for this function.
func (*ChannelBasedSinkFunc) Info ¶
func (obj *ChannelBasedSinkFunc) Info() *interfaces.Info
Info returns some static info about itself.
func (*ChannelBasedSinkFunc) Init ¶
func (obj *ChannelBasedSinkFunc) Init(init *interfaces.Init) error
Init runs some startup code for this function.
func (*ChannelBasedSinkFunc) Stream ¶
func (obj *ChannelBasedSinkFunc) Stream(ctx context.Context) error
Stream returns the changing values that this func has over time.
func (*ChannelBasedSinkFunc) String ¶
func (obj *ChannelBasedSinkFunc) String() string
String returns a simple name for this function. This is needed so this struct can satisfy the pgraph.Vertex interface.
func (*ChannelBasedSinkFunc) Validate ¶
func (obj *ChannelBasedSinkFunc) Validate() error
Validate makes sure we've built our struct properly. It is usually unused for normal functions that users can use directly.
type ChannelBasedSourceFunc ¶
type ChannelBasedSourceFunc struct { Name string Source interfaces.Func // for drawing dashed edges in the Graphviz visualization Chan chan types.Value Type *types.Type // contains filtered or unexported fields }
ChannelBasedSourceFunc is a Func which receives values from a golang channel and emits them to the downstream nodes.
func (*ChannelBasedSourceFunc) ArgGen ¶
func (obj *ChannelBasedSourceFunc) ArgGen(index int) (string, error)
ArgGen returns the Nth arg name for this function.
func (*ChannelBasedSourceFunc) Info ¶
func (obj *ChannelBasedSourceFunc) Info() *interfaces.Info
Info returns some static info about itself.
func (*ChannelBasedSourceFunc) Init ¶
func (obj *ChannelBasedSourceFunc) Init(init *interfaces.Init) error
Init runs some startup code for this function.
func (*ChannelBasedSourceFunc) Stream ¶
func (obj *ChannelBasedSourceFunc) Stream(ctx context.Context) error
Stream returns the changing values that this func has over time.
func (*ChannelBasedSourceFunc) String ¶
func (obj *ChannelBasedSourceFunc) String() string
String returns a simple name for this function. This is needed so this struct can satisfy the pgraph.Vertex interface.
func (*ChannelBasedSourceFunc) Validate ¶
func (obj *ChannelBasedSourceFunc) Validate() error
Validate makes sure we've built our struct properly. It is usually unused for normal functions that users can use directly.
type CompositeFunc ¶
type CompositeFunc struct { Type *types.Type // this is the type of the composite value we hold Len int // length of list or map (if used) // contains filtered or unexported fields }
CompositeFunc is a function that passes through the value it receives. It is used to take a series of inputs to a list, map or struct, and return that value as a stream that depends on those inputs. It helps the list, map, and struct's that fulfill the Expr interface but expressing a Func method.
func (*CompositeFunc) Call ¶
Call this function with the input args and return the value if it is possible to do so at this time.
func (*CompositeFunc) Info ¶
func (obj *CompositeFunc) Info() *interfaces.Info
Info returns some static info about itself.
func (*CompositeFunc) Init ¶
func (obj *CompositeFunc) Init(init *interfaces.Init) error
Init runs some startup code for this composite function.
func (*CompositeFunc) Stream ¶
func (obj *CompositeFunc) Stream(ctx context.Context) error
Stream takes an input struct in the format as described in the Func and Graph methods of the Expr, and returns the actual expected value as a stream based on the changing inputs to that value.
func (*CompositeFunc) String ¶
func (obj *CompositeFunc) String() string
String returns a simple name for this function. This is needed so this struct can satisfy the pgraph.Vertex interface.
func (*CompositeFunc) StructCall ¶
StructCall is a different Call API which is sometimes easier to implement.
func (*CompositeFunc) Validate ¶
func (obj *CompositeFunc) Validate() error
Validate makes sure we've built our struct properly.
type ConstFunc ¶
type ConstFunc struct { Value types.Value NameHint string // contains filtered or unexported fields }
ConstFunc is a function that returns the constant value passed to Value.
func (*ConstFunc) Call ¶
Call this function with the input args and return the value if it is possible to do so at this time.
func (*ConstFunc) Info ¶
func (obj *ConstFunc) Info() *interfaces.Info
Info returns some static info about itself.
func (*ConstFunc) Init ¶
func (obj *ConstFunc) Init(init *interfaces.Init) error
Init runs some startup code for this const.
type IfFunc ¶
type IfFunc struct { Type *types.Type // this is the type of the if expression output we hold // contains filtered or unexported fields }
IfFunc is a function that passes through the value of the correct branch based on the conditional value it gets.
func (*IfFunc) Info ¶
func (obj *IfFunc) Info() *interfaces.Info
Info returns some static info about itself.
func (*IfFunc) Init ¶
func (obj *IfFunc) Init(init *interfaces.Init) error
Init runs some startup code for this if expression function.
func (*IfFunc) Stream ¶
Stream takes an input struct in the format as described in the Func and Graph methods of the Expr, and returns the actual expected value as a stream based on the changing inputs to that value.