Documentation ¶
Overview ¶
Package core contains core functions and other related facilities which are used in programs.
Index ¶
- Constants
- func Asset(name string) ([]byte, error)
- func AssetNames() ([]string, error)
- func Concat(ctx context.Context, input []types.Value) (types.Value, error)
- func Len(ctx context.Context, input []types.Value) (types.Value, error)
- func Panic(ctx context.Context, input []types.Value) (types.Value, error)
- type ContainsFunc
- func (obj *ContainsFunc) ArgGen(index int) (string, error)
- func (obj *ContainsFunc) Build(typ *types.Type) (*types.Type, error)
- func (obj *ContainsFunc) Info() *interfaces.Info
- func (obj *ContainsFunc) Init(init *interfaces.Init) error
- func (obj *ContainsFunc) Stream(ctx context.Context) error
- func (obj *ContainsFunc) String() string
- func (obj *ContainsFunc) Validate() error
- type HistoryFunc
- func (obj *HistoryFunc) ArgGen(index int) (string, error)
- func (obj *HistoryFunc) Build(typ *types.Type) (*types.Type, error)
- func (obj *HistoryFunc) Info() *interfaces.Info
- func (obj *HistoryFunc) Init(init *interfaces.Init) error
- func (obj *HistoryFunc) Stream(ctx context.Context) error
- func (obj *HistoryFunc) String() string
- func (obj *HistoryFunc) Validate() error
- type ListLookupDefaultFunc
- func (obj *ListLookupDefaultFunc) ArgGen(index int) (string, error)
- func (obj *ListLookupDefaultFunc) Build(typ *types.Type) (*types.Type, error)
- func (obj *ListLookupDefaultFunc) Info() *interfaces.Info
- func (obj *ListLookupDefaultFunc) Init(init *interfaces.Init) error
- func (obj *ListLookupDefaultFunc) Stream(ctx context.Context) error
- func (obj *ListLookupDefaultFunc) String() string
- func (obj *ListLookupDefaultFunc) Validate() error
- type ListLookupFunc
- func (obj *ListLookupFunc) ArgGen(index int) (string, error)
- func (obj *ListLookupFunc) Build(typ *types.Type) (*types.Type, error)
- func (obj *ListLookupFunc) Info() *interfaces.Info
- func (obj *ListLookupFunc) Init(init *interfaces.Init) error
- func (obj *ListLookupFunc) Stream(ctx context.Context) error
- func (obj *ListLookupFunc) String() string
- func (obj *ListLookupFunc) Validate() error
- type LookupDefaultFunc
- func (obj *LookupDefaultFunc) ArgGen(index int) (string, error)
- func (obj *LookupDefaultFunc) Build(typ *types.Type) (*types.Type, error)
- func (obj *LookupDefaultFunc) Info() *interfaces.Info
- func (obj *LookupDefaultFunc) Init(init *interfaces.Init) error
- func (obj *LookupDefaultFunc) Stream(ctx context.Context) error
- func (obj *LookupDefaultFunc) String() string
- func (obj *LookupDefaultFunc) Validate() error
- type LookupFunc
- func (obj *LookupFunc) ArgGen(index int) (string, error)
- func (obj *LookupFunc) Build(typ *types.Type) (*types.Type, error)
- func (obj *LookupFunc) Info() *interfaces.Info
- func (obj *LookupFunc) Init(init *interfaces.Init) error
- func (obj *LookupFunc) Stream(ctx context.Context) error
- func (obj *LookupFunc) String() string
- func (obj *LookupFunc) Validate() error
- type MapLookupDefaultFunc
- func (obj *MapLookupDefaultFunc) ArgGen(index int) (string, error)
- func (obj *MapLookupDefaultFunc) Build(typ *types.Type) (*types.Type, error)
- func (obj *MapLookupDefaultFunc) Info() *interfaces.Info
- func (obj *MapLookupDefaultFunc) Init(init *interfaces.Init) error
- func (obj *MapLookupDefaultFunc) Stream(ctx context.Context) error
- func (obj *MapLookupDefaultFunc) String() string
- func (obj *MapLookupDefaultFunc) Validate() error
- type MapLookupFunc
- func (obj *MapLookupFunc) ArgGen(index int) (string, error)
- func (obj *MapLookupFunc) Build(typ *types.Type) (*types.Type, error)
- func (obj *MapLookupFunc) Info() *interfaces.Info
- func (obj *MapLookupFunc) Init(init *interfaces.Init) error
- func (obj *MapLookupFunc) Stream(ctx context.Context) error
- func (obj *MapLookupFunc) String() string
- func (obj *MapLookupFunc) Validate() error
- type Random1Func
- func (obj *Random1Func) ArgGen(index int) (string, error)
- func (obj *Random1Func) Info() *interfaces.Info
- func (obj *Random1Func) Init(init *interfaces.Init) error
- func (obj *Random1Func) Stream(ctx context.Context) error
- func (obj *Random1Func) String() string
- func (obj *Random1Func) Validate() error
- type StructLookupFunc
- func (obj *StructLookupFunc) ArgGen(index int) (string, error)
- func (obj *StructLookupFunc) Build(typ *types.Type) (*types.Type, error)
- func (obj *StructLookupFunc) Copy() interfaces.Func
- func (obj *StructLookupFunc) FuncInfer(partialType *types.Type, partialValues []types.Value) (*types.Type, []*interfaces.UnificationInvariant, error)
- func (obj *StructLookupFunc) Info() *interfaces.Info
- func (obj *StructLookupFunc) Init(init *interfaces.Init) error
- func (obj *StructLookupFunc) Stream(ctx context.Context) error
- func (obj *StructLookupFunc) String() string
- func (obj *StructLookupFunc) Validate() error
- type StructLookupOptionalFunc
- func (obj *StructLookupOptionalFunc) ArgGen(index int) (string, error)
- func (obj *StructLookupOptionalFunc) Build(typ *types.Type) (*types.Type, error)
- func (obj *StructLookupOptionalFunc) FuncInfer(partialType *types.Type, partialValues []types.Value) (*types.Type, []*interfaces.UnificationInvariant, error)
- func (obj *StructLookupOptionalFunc) Info() *interfaces.Info
- func (obj *StructLookupOptionalFunc) Init(init *interfaces.Init) error
- func (obj *StructLookupOptionalFunc) Stream(ctx context.Context) error
- func (obj *StructLookupOptionalFunc) String() string
- func (obj *StructLookupOptionalFunc) Validate() error
Constants ¶
const ( // ConcatFuncName is the name this function is registered as. ConcatFuncName = funcs.ConcatFuncName )
const ( // ContainsFuncName is the name this function is registered as. ContainsFuncName = funcs.ContainsFuncName )
const ( // HistoryFuncName is the name this function is registered as. // TODO: move this into a separate package HistoryFuncName = "history" )
const (
// ListLookupDefaultFuncName is the name this function is registered as.
ListLookupDefaultFuncName = "list_lookup_default"
)
const (
// ListLookupFuncName is the name this function is registered as.
ListLookupFuncName = "list_lookup"
)
const ( // LookupDefaultFuncName is the name this function is registered as. // This starts with an underscore so that it cannot be used from the // lexer. LookupDefaultFuncName = funcs.LookupDefaultFuncName )
const ( // LookupFuncName is the name this function is registered as. // This starts with an underscore so that it cannot be used from the // lexer. LookupFuncName = funcs.LookupFuncName )
const (
// MapLookupDefaultFuncName is the name this function is registered as.
MapLookupDefaultFuncName = "map_lookup_default"
)
const (
// MapLookupFuncName is the name this function is registered as.
MapLookupFuncName = "map_lookup"
)
const (
// Random1FuncName is the name this function is registered as.
Random1FuncName = "random1"
)
const ( // StructLookupFuncName is the name this function is registered as. This // starts with an underscore so that it cannot be used from the lexer. StructLookupFuncName = funcs.StructLookupFuncName )
const ( // StructLookupOptionalFuncName is the name this function is registered // as. This starts with an underscore so that it cannot be used from the // lexer. StructLookupOptionalFuncName = funcs.StructLookupOptionalFuncName )
Variables ¶
This section is empty.
Functions ¶
func AssetNames ¶
AssetNames returns a flattened list of embedded .mcl file paths.
Types ¶
type ContainsFunc ¶
type ContainsFunc struct { Type *types.Type // this is the type of value stored in our list // contains filtered or unexported fields }
ContainsFunc returns true if a value is found in a list. Otherwise false.
func (*ContainsFunc) ArgGen ¶
func (obj *ContainsFunc) ArgGen(index int) (string, error)
ArgGen returns the Nth arg name for this function.
func (*ContainsFunc) Build ¶
Build is run to turn the polymorphic, undetermined function, into the specific statically typed version. It is usually run after Unify completes, and must be run before Info() and any of the other Func interface methods are used. This function is idempotent, as long as the arg isn't changed between runs.
func (*ContainsFunc) Info ¶
func (obj *ContainsFunc) Info() *interfaces.Info
Info returns some static info about itself. Build must be called before this will return correct data.
func (*ContainsFunc) Init ¶
func (obj *ContainsFunc) Init(init *interfaces.Init) error
Init runs some startup code for this function.
func (*ContainsFunc) Stream ¶
func (obj *ContainsFunc) Stream(ctx context.Context) error
Stream returns the changing values that this func has over time.
func (*ContainsFunc) String ¶
func (obj *ContainsFunc) String() string
String returns a simple name for this function. This is needed so this struct can satisfy the pgraph.Vertex interface.
func (*ContainsFunc) Validate ¶
func (obj *ContainsFunc) Validate() error
Validate tells us if the input struct takes a valid form.
type HistoryFunc ¶
type HistoryFunc struct { Type *types.Type // type of input value (same as output type) // contains filtered or unexported fields }
HistoryFunc is special function which returns the Nth oldest value seen. It must store up incoming values until it gets enough to return the desired one. A restart of the program, will expunge the stored state. This obviously takes more memory, the further back you wish to index. A change in the index var is generally not useful, but it is permitted. Moving it to a smaller value will cause older index values to be expunged. If this is undesirable, a max count could be added. This was not implemented with efficiency in mind. Since some functions might not send out un-changed values, it might also make sense to implement a *time* based hysteresis, since this only looks at the last N changed values. A time based hysteresis would tick every precision-width, and store whatever the latest value at that time is.
func (*HistoryFunc) ArgGen ¶
func (obj *HistoryFunc) ArgGen(index int) (string, error)
ArgGen returns the Nth arg name for this function.
func (*HistoryFunc) Build ¶
Build takes the now known function signature and stores it so that this function can appear to be static. That type is used to build our function statically.
func (*HistoryFunc) Info ¶
func (obj *HistoryFunc) Info() *interfaces.Info
Info returns some static info about itself.
func (*HistoryFunc) Init ¶
func (obj *HistoryFunc) Init(init *interfaces.Init) error
Init runs some startup code for this function.
func (*HistoryFunc) Stream ¶
func (obj *HistoryFunc) Stream(ctx context.Context) error
Stream returns the changing values that this func has over time.
func (*HistoryFunc) String ¶
func (obj *HistoryFunc) String() string
String returns a simple name for this function. This is needed so this struct can satisfy the pgraph.Vertex interface.
func (*HistoryFunc) Validate ¶
func (obj *HistoryFunc) Validate() error
Validate makes sure we've built our struct properly. It is usually unused for normal functions that users can use directly.
type ListLookupDefaultFunc ¶
type ListLookupDefaultFunc struct { // TODO: Logically should this be ported to be the type of the elements? Type *types.Type // Kind == List, that is used as the list we lookup in // contains filtered or unexported fields }
ListLookupDefaultFunc is a list index lookup function. If you provide a negative index, then it will return the default value you specified for this function. TODO: Eventually we will deprecate this function when the function engine can support passing a value for erroring functions. (Bad index could be an err!)
func (*ListLookupDefaultFunc) ArgGen ¶
func (obj *ListLookupDefaultFunc) ArgGen(index int) (string, error)
ArgGen returns the Nth arg name for this function.
func (*ListLookupDefaultFunc) Build ¶
Build is run to turn the polymorphic, undetermined function, into the specific statically typed version. It is usually run after Unify completes, and must be run before Info() and any of the other Func interface methods are used. This function is idempotent, as long as the arg isn't changed between runs.
func (*ListLookupDefaultFunc) Info ¶
func (obj *ListLookupDefaultFunc) Info() *interfaces.Info
Info returns some static info about itself. Build must be called before this will return correct data.
func (*ListLookupDefaultFunc) Init ¶
func (obj *ListLookupDefaultFunc) Init(init *interfaces.Init) error
Init runs some startup code for this function.
func (*ListLookupDefaultFunc) Stream ¶
func (obj *ListLookupDefaultFunc) Stream(ctx context.Context) error
Stream returns the changing values that this func has over time.
func (*ListLookupDefaultFunc) String ¶
func (obj *ListLookupDefaultFunc) String() string
String returns a simple name for this function. This is needed so this struct can satisfy the pgraph.Vertex interface.
func (*ListLookupDefaultFunc) Validate ¶
func (obj *ListLookupDefaultFunc) Validate() error
Validate tells us if the input struct takes a valid form.
type ListLookupFunc ¶
type ListLookupFunc struct { Type *types.Type // Kind == List, that is used as the list we lookup in // contains filtered or unexported fields }
ListLookupFunc is a list index lookup function. If you provide a negative index, then it will return the zero value for that type.
func (*ListLookupFunc) ArgGen ¶
func (obj *ListLookupFunc) ArgGen(index int) (string, error)
ArgGen returns the Nth arg name for this function.
func (*ListLookupFunc) Build ¶
Build is run to turn the polymorphic, undetermined function, into the specific statically typed version. It is usually run after Unify completes, and must be run before Info() and any of the other Func interface methods are used. This function is idempotent, as long as the arg isn't changed between runs.
func (*ListLookupFunc) Info ¶
func (obj *ListLookupFunc) Info() *interfaces.Info
Info returns some static info about itself. Build must be called before this will return correct data.
func (*ListLookupFunc) Init ¶
func (obj *ListLookupFunc) Init(init *interfaces.Init) error
Init runs some startup code for this function.
func (*ListLookupFunc) Stream ¶
func (obj *ListLookupFunc) Stream(ctx context.Context) error
Stream returns the changing values that this func has over time.
func (*ListLookupFunc) String ¶
func (obj *ListLookupFunc) String() string
String returns a simple name for this function. This is needed so this struct can satisfy the pgraph.Vertex interface.
func (*ListLookupFunc) Validate ¶
func (obj *ListLookupFunc) Validate() error
Validate tells us if the input struct takes a valid form.
type LookupDefaultFunc ¶
type LookupDefaultFunc struct { Type *types.Type // Kind == List OR Map, that is used as the list/map we lookup in // contains filtered or unexported fields }
LookupDefaultFunc is a list index or map key lookup function. It does both because the current syntax in the parser is identical, so it's convenient to mix the two together. This calls out to some of the code in the ListLookupDefaultFunc and MapLookupDefaultFunc implementations. If the index or key for this input doesn't exist, then it will return the default value you specified for this function. TODO: Eventually we will deprecate this function when the function engine can support passing a value for erroring functions. (Bad index could be an err!)
func (*LookupDefaultFunc) ArgGen ¶
func (obj *LookupDefaultFunc) ArgGen(index int) (string, error)
ArgGen returns the Nth arg name for this function.
func (*LookupDefaultFunc) Build ¶
Build is run to turn the polymorphic, undetermined function, into the specific statically typed version. It is usually run after Unify completes, and must be run before Info() and any of the other Func interface methods are used. This function is idempotent, as long as the arg isn't changed between runs.
func (*LookupDefaultFunc) Info ¶
func (obj *LookupDefaultFunc) Info() *interfaces.Info
Info returns some static info about itself. Build must be called before this will return correct data.
func (*LookupDefaultFunc) Init ¶
func (obj *LookupDefaultFunc) Init(init *interfaces.Init) error
Init runs some startup code for this function.
func (*LookupDefaultFunc) Stream ¶
func (obj *LookupDefaultFunc) Stream(ctx context.Context) error
Stream returns the changing values that this func has over time.
func (*LookupDefaultFunc) String ¶
func (obj *LookupDefaultFunc) String() string
String returns a simple name for this function. This is needed so this struct can satisfy the pgraph.Vertex interface.
func (*LookupDefaultFunc) Validate ¶
func (obj *LookupDefaultFunc) Validate() error
Validate tells us if the input struct takes a valid form.
type LookupFunc ¶
type LookupFunc struct { Type *types.Type // Kind == List OR Map, that is used as the list/map we lookup in // contains filtered or unexported fields }
LookupFunc is a list index or map key lookup function. It does both because the current syntax in the parser is identical, so it's convenient to mix the two together. This calls out to some of the code in the ListLookupFunc and MapLookupFunc implementations. If the index or key for this input doesn't exist, then it will return the zero value for that type. TODO: Eventually we will deprecate this function when the function engine can support passing a value for erroring functions. (Bad index could be an err!)
func (*LookupFunc) ArgGen ¶
func (obj *LookupFunc) ArgGen(index int) (string, error)
ArgGen returns the Nth arg name for this function.
func (*LookupFunc) Build ¶
Build is run to turn the polymorphic, undetermined function, into the specific statically typed version. It is usually run after Unify completes, and must be run before Info() and any of the other Func interface methods are used. This function is idempotent, as long as the arg isn't changed between runs.
func (*LookupFunc) Info ¶
func (obj *LookupFunc) Info() *interfaces.Info
Info returns some static info about itself. Build must be called before this will return correct data.
func (*LookupFunc) Init ¶
func (obj *LookupFunc) Init(init *interfaces.Init) error
Init runs some startup code for this function.
func (*LookupFunc) Stream ¶
func (obj *LookupFunc) Stream(ctx context.Context) error
Stream returns the changing values that this func has over time.
func (*LookupFunc) String ¶
func (obj *LookupFunc) String() string
String returns a simple name for this function. This is needed so this struct can satisfy the pgraph.Vertex interface.
func (*LookupFunc) Validate ¶
func (obj *LookupFunc) Validate() error
Validate tells us if the input struct takes a valid form.
type MapLookupDefaultFunc ¶
type MapLookupDefaultFunc struct { Type *types.Type // Kind == Map, that is used as the map we lookup // contains filtered or unexported fields }
MapLookupDefaultFunc is a key map lookup function. If you provide a missing key, then it will return the default value you specified for this function. TODO: Eventually we will deprecate this function when the function engine can support passing a value for erroring functions. (Bad index could be an err!)
func (*MapLookupDefaultFunc) ArgGen ¶
func (obj *MapLookupDefaultFunc) ArgGen(index int) (string, error)
ArgGen returns the Nth arg name for this function.
func (*MapLookupDefaultFunc) Build ¶
Build is run to turn the polymorphic, undetermined function, into the specific statically typed version. It is usually run after Unify completes, and must be run before Info() and any of the other Func interface methods are used. This function is idempotent, as long as the arg isn't changed between runs.
func (*MapLookupDefaultFunc) Info ¶
func (obj *MapLookupDefaultFunc) Info() *interfaces.Info
Info returns some static info about itself. Build must be called before this will return correct data.
func (*MapLookupDefaultFunc) Init ¶
func (obj *MapLookupDefaultFunc) Init(init *interfaces.Init) error
Init runs some startup code for this function.
func (*MapLookupDefaultFunc) Stream ¶
func (obj *MapLookupDefaultFunc) Stream(ctx context.Context) error
Stream returns the changing values that this func has over time.
func (*MapLookupDefaultFunc) String ¶
func (obj *MapLookupDefaultFunc) String() string
String returns a simple name for this function. This is needed so this struct can satisfy the pgraph.Vertex interface.
func (*MapLookupDefaultFunc) Validate ¶
func (obj *MapLookupDefaultFunc) Validate() error
Validate tells us if the input struct takes a valid form.
type MapLookupFunc ¶
type MapLookupFunc struct { Type *types.Type // Kind == Map, that is used as the map we lookup // contains filtered or unexported fields }
MapLookupFunc is a key map lookup function. If you provide a missing key, then it will return the zero value for that type.
func (*MapLookupFunc) ArgGen ¶
func (obj *MapLookupFunc) ArgGen(index int) (string, error)
ArgGen returns the Nth arg name for this function.
func (*MapLookupFunc) Build ¶
Build is run to turn the polymorphic, undetermined function, into the specific statically typed version. It is usually run after Unify completes, and must be run before Info() and any of the other Func interface methods are used. This function is idempotent, as long as the arg isn't changed between runs.
func (*MapLookupFunc) Info ¶
func (obj *MapLookupFunc) Info() *interfaces.Info
Info returns some static info about itself. Build must be called before this will return correct data.
func (*MapLookupFunc) Init ¶
func (obj *MapLookupFunc) Init(init *interfaces.Init) error
Init runs some startup code for this function.
func (*MapLookupFunc) Stream ¶
func (obj *MapLookupFunc) Stream(ctx context.Context) error
Stream returns the changing values that this func has over time.
func (*MapLookupFunc) String ¶
func (obj *MapLookupFunc) String() string
String returns a simple name for this function. This is needed so this struct can satisfy the pgraph.Vertex interface.
func (*MapLookupFunc) Validate ¶
func (obj *MapLookupFunc) Validate() error
Validate tells us if the input struct takes a valid form.
type Random1Func ¶
type Random1Func struct {
// contains filtered or unexported fields
}
Random1Func returns one random string of a certain length. XXX: return a stream instead, and combine this with a first(?) function which takes the first value and then puts backpressure on the stream. This should notify parent functions somehow that their values are no longer required so that they can shutdown if possible. Maybe it should be returning a stream of floats [0,1] as well, which someone can later map to the alphabet that they want. Should random() take an interval to know how often to spit out values? It could also just do it once per second, and we could filter for less. If we want something high precision, we could add that in the future... We could name that "random" and this one can be "random1" until we deprecate it.
func (*Random1Func) ArgGen ¶
func (obj *Random1Func) ArgGen(index int) (string, error)
ArgGen returns the Nth arg name for this function.
func (*Random1Func) Info ¶
func (obj *Random1Func) Info() *interfaces.Info
Info returns some static info about itself.
func (*Random1Func) Init ¶
func (obj *Random1Func) Init(init *interfaces.Init) error
Init runs some startup code for this function.
func (*Random1Func) Stream ¶
func (obj *Random1Func) Stream(ctx context.Context) error
Stream returns the single value that was generated and then closes.
func (*Random1Func) String ¶
func (obj *Random1Func) String() string
String returns a simple name for this function. This is needed so this struct can satisfy the pgraph.Vertex interface.
func (*Random1Func) Validate ¶
func (obj *Random1Func) Validate() error
Validate makes sure we've built our struct properly. It is usually unused for normal functions that users can use directly.
type StructLookupFunc ¶
type StructLookupFunc struct { Type *types.Type // Kind == Struct, that is used as the struct we lookup Out *types.Type // type of field we're extracting // contains filtered or unexported fields }
StructLookupFunc is a struct field lookup function.
func (*StructLookupFunc) ArgGen ¶
func (obj *StructLookupFunc) ArgGen(index int) (string, error)
ArgGen returns the Nth arg name for this function.
func (*StructLookupFunc) Build ¶
Build is run to turn the polymorphic, undetermined function, into the specific statically typed version. It is usually run after Unify completes, and must be run before Info() and any of the other Func interface methods are used. This function is idempotent, as long as the arg isn't changed between runs.
func (*StructLookupFunc) Copy ¶
func (obj *StructLookupFunc) Copy() interfaces.Func
Copy is implemented so that the obj.field value is not lost if we copy this function. That value is learned during FuncInfer, and previously would have been lost by the time we used it in Build.
func (*StructLookupFunc) FuncInfer ¶
func (obj *StructLookupFunc) FuncInfer(partialType *types.Type, partialValues []types.Value) (*types.Type, []*interfaces.UnificationInvariant, error)
FuncInfer takes partial type and value information from the call site of this function so that it can build an appropriate type signature for it. The type signature may include unification variables.
func (*StructLookupFunc) Info ¶
func (obj *StructLookupFunc) Info() *interfaces.Info
Info returns some static info about itself. Build must be called before this will return correct data.
func (*StructLookupFunc) Init ¶
func (obj *StructLookupFunc) Init(init *interfaces.Init) error
Init runs some startup code for this function.
func (*StructLookupFunc) Stream ¶
func (obj *StructLookupFunc) Stream(ctx context.Context) error
Stream returns the changing values that this func has over time.
func (*StructLookupFunc) String ¶
func (obj *StructLookupFunc) String() string
String returns a simple name for this function. This is needed so this struct can satisfy the pgraph.Vertex interface.
func (*StructLookupFunc) Validate ¶
func (obj *StructLookupFunc) Validate() error
Validate tells us if the input struct takes a valid form.
type StructLookupOptionalFunc ¶
type StructLookupOptionalFunc struct { Type *types.Type // Kind == Struct, that is used as the struct we lookup Out *types.Type // type of field we're extracting (also the type of optional) // contains filtered or unexported fields }
StructLookupOptionalFunc is a struct field lookup function. It does a special trick in that it will unify on a struct that doesn't have the specified field in it, but in that case, it will always return the optional value. This is a bit different from the "default" mechanism that is used by list and map lookup functions.
func (*StructLookupOptionalFunc) ArgGen ¶
func (obj *StructLookupOptionalFunc) ArgGen(index int) (string, error)
ArgGen returns the Nth arg name for this function.
func (*StructLookupOptionalFunc) Build ¶
Build is run to turn the polymorphic, undetermined function, into the specific statically typed version. It is usually run after Unify completes, and must be run before Info() and any of the other Func interface methods are used. This function is idempotent, as long as the arg isn't changed between runs.
func (*StructLookupOptionalFunc) FuncInfer ¶
func (obj *StructLookupOptionalFunc) FuncInfer(partialType *types.Type, partialValues []types.Value) (*types.Type, []*interfaces.UnificationInvariant, error)
FuncInfer takes partial type and value information from the call site of this function so that it can build an appropriate type signature for it. The type signature may include unification variables.
func (*StructLookupOptionalFunc) Info ¶
func (obj *StructLookupOptionalFunc) Info() *interfaces.Info
Info returns some static info about itself. Build must be called before this will return correct data.
func (*StructLookupOptionalFunc) Init ¶
func (obj *StructLookupOptionalFunc) Init(init *interfaces.Init) error
Init runs some startup code for this function.
func (*StructLookupOptionalFunc) Stream ¶
func (obj *StructLookupOptionalFunc) Stream(ctx context.Context) error
Stream returns the changing values that this func has over time.
func (*StructLookupOptionalFunc) String ¶
func (obj *StructLookupOptionalFunc) String() string
String returns a simple name for this function. This is needed so this struct can satisfy the pgraph.Vertex interface.
func (*StructLookupOptionalFunc) Validate ¶
func (obj *StructLookupOptionalFunc) Validate() error
Validate tells us if the input struct takes a valid form.