structs

package
v0.0.0-...-453cd44 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: GPL-3.0 Imports: 7 Imported by: 5

Documentation

Index

Constants

View Source
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"
)
View Source
const (
	// ChannelBasedSinkFuncArgName is the name for the edge which connects
	// the input value to ChannelBasedSinkFunc.
	ChannelBasedSinkFuncArgName = "channelBasedSinkFuncArg"
)
View Source
const (
	// CompositeFuncName is the unique name identifier for this function.
	CompositeFuncName = "composite"
)
View Source
const (
	// ConstFuncName is the unique name identifier for this function.
	ConstFuncName = "const"
)
View Source
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{}.

func SimpleFnToFuncValue

func SimpleFnToFuncValue(name string, fv *types.FuncValue) *full.FuncValue

SimpleFnToFuncValue transforms a name and *types.FuncValue into a *full.FuncValue.

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

func (obj *CallFunc) 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 (*CallFunc) String

func (obj *CallFunc) String() string

String returns a simple name for this function. This is needed so this struct can satisfy the pgraph.Vertex interface.

func (*CallFunc) Validate

func (obj *CallFunc) Validate() error

Validate makes sure we've built our struct properly.

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) 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) 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) 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.

func (*ConstFunc) Stream

func (obj *ConstFunc) Stream(ctx context.Context) error

Stream returns the single value that this const has, and then closes.

func (*ConstFunc) String

func (obj *ConstFunc) String() string

String returns a simple name for this function. This is needed so this struct can satisfy the pgraph.Vertex interface.

func (*ConstFunc) Validate

func (obj *ConstFunc) Validate() error

Validate makes sure we've built our struct properly.

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

func (obj *IfFunc) 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 (*IfFunc) String

func (obj *IfFunc) String() string

String returns a simple name for this function. This is needed so this struct can satisfy the pgraph.Vertex interface.

func (*IfFunc) Validate

func (obj *IfFunc) Validate() error

Validate tells us if the input struct takes a valid form.

Jump to

Keyboard shortcuts

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