Documentation ¶
Index ¶
- func ParamListToParamMap(args []string) map[string]string
- type Context
- type FreepsBaseOperator
- type FreepsExampleOperator
- func (feo *FreepsExampleOperator) ExecuteDynamic(ctx *Context, fn string, mainArgs FunctionArguments, mainInput *OperatorIO) *OperatorIO
- func (feo *FreepsExampleOperator) GetDefaultConfig() interface{}
- func (feo *FreepsExampleOperator) GetDynamicArgSuggestions(fn string, arg string, otherArgs FunctionArguments) map[string]string
- func (feo *FreepsExampleOperator) GetDynamicFunctions() []string
- func (feo *FreepsExampleOperator) GetDynamicPossibleArgs(fn string) []string
- func (feo *FreepsExampleOperator) GetHook() interface{}
- func (feo *FreepsExampleOperator) InitCopyOfOperator(ctx *Context, config interface{}, fullOperatorName string) (FreepsOperatorWithConfig, error)
- func (feo *FreepsExampleOperator) Shutdown(ctx *Context)
- func (feo *FreepsExampleOperator) StartListening(ctx *Context)
- type FreepsFunctionMetaData
- type FreepsFunctionParameters
- type FreepsFunctionParametersWithInit
- type FreepsFunctionType
- type FreepsOperator
- type FreepsOperatorWithConfig
- type FreepsOperatorWithDynamicFunctions
- type FreepsOperatorWithHook
- type FreepsOperatorWithShutdown
- type FreepsOperatorWrapper
- func (o *FreepsOperatorWrapper) Execute(ctx *Context, function string, args map[string]string, mainInput *OperatorIO) *OperatorIO
- func (o *FreepsOperatorWrapper) GetArgSuggestions(function string, argName string, otherArgs map[string]string) map[string]string
- func (o *FreepsOperatorWrapper) GetCommonParameterSuggestions(parmStruct reflect.Value, paramName string) []string
- func (o *FreepsOperatorWrapper) GetConfig() interface{}
- func (o *FreepsOperatorWrapper) GetFunctions() []string
- func (o *FreepsOperatorWrapper) GetHook() interface{}
- func (o *FreepsOperatorWrapper) GetName() string
- func (o *FreepsOperatorWrapper) GetPossibleArgs(fn string) []string
- func (o *FreepsOperatorWrapper) SetOptionalFreepsFunctionParameters(freepsFuncParams reflect.Value, args map[string]string, failOnErr bool) *OperatorIO
- func (o *FreepsOperatorWrapper) SetRequiredFreepsFunctionParameters(freepsFuncParams reflect.Value, args map[string]string, failOnErr bool) *OperatorIO
- func (o *FreepsOperatorWrapper) Shutdown(ctx *Context)
- func (o *FreepsOperatorWrapper) StartListening(ctx *Context)
- type FunctionArguments
- type OperatorIO
- func MakeByteOutput(output []byte) *OperatorIO
- func MakeByteOutputWithContentType(output []byte, contentType string) *OperatorIO
- func MakeEmptyOutput() *OperatorIO
- func MakeObjectOutput(output interface{}) *OperatorIO
- func MakeObjectOutputWithContentType(output interface{}, contentType string) *OperatorIO
- func MakeOutputError(code int, msg string, a ...interface{}) *OperatorIO
- func MakePlainOutput(msg string) *OperatorIO
- func MakeSprintfOutput(msg string, a ...interface{}) *OperatorIO
- func (io *OperatorIO) GetArgsMap() (map[string]string, error)
- func (io *OperatorIO) GetBytes() ([]byte, error)
- func (io *OperatorIO) GetError() error
- func (io *OperatorIO) GetObject() interface{}
- func (io *OperatorIO) GetSize() (int, error)
- func (io *OperatorIO) GetStatusCode() int
- func (io *OperatorIO) GetString() string
- func (io *OperatorIO) IsEmpty() bool
- func (io *OperatorIO) IsError() bool
- func (io *OperatorIO) IsFormData() bool
- func (io *OperatorIO) IsObject() bool
- func (io *OperatorIO) IsPlain() bool
- func (oio *OperatorIO) Log(logger logrus.FieldLogger)
- func (io *OperatorIO) ParseFormData() (url.Values, error)
- func (io *OperatorIO) ParseJSON(obj interface{}) error
- func (oio *OperatorIO) ToString() string
- func (oio *OperatorIO) WriteTo(bwriter io.Writer) (int, error)
- type OutputT
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParamListToParamMap ¶
ParamListToParamMap is a helper function that converts a list of strings to a map of strings (key==value)
Types ¶
type Context ¶
Context keeps the runtime data of a graph execution tree
func NewContext ¶
func NewContext(logger log.FieldLogger) *Context
NewContext creates a Context with a given logger
func (*Context) GetLogger ¶
func (c *Context) GetLogger() log.FieldLogger
GetLogger returns a Logger with the proper fields added to identify the context
type FreepsBaseOperator ¶
type FreepsBaseOperator interface { Execute(ctx *Context, fn string, mainArgs map[string]string, mainInput *OperatorIO) *OperatorIO GetFunctions() []string // returns a list of functions that this operator can execute GetPossibleArgs(fn string) []string GetArgSuggestions(fn string, arg string, otherArgs map[string]string) map[string]string GetName() string GetHook() interface{} StartListening(*Context) Shutdown(*Context) }
FreepsBaseOperator provides the interface for all operators used by the graph module Operators can either implement this interface directly or use MakeFreepsOperator to convert a struct into an operator
func MakeFreepsOperators ¶
func MakeFreepsOperators(anyClass FreepsOperator, cr *utils.ConfigReader, ctx *Context) []FreepsBaseOperator
MakeFreepsOperators creates FreepsBaseOperator variations from any struct that implements FreepsOperator
type FreepsExampleOperator ¶
type FreepsExampleOperator struct{}
func (*FreepsExampleOperator) ExecuteDynamic ¶
func (feo *FreepsExampleOperator) ExecuteDynamic(ctx *Context, fn string, mainArgs FunctionArguments, mainInput *OperatorIO) *OperatorIO
func (*FreepsExampleOperator) GetDefaultConfig ¶
func (feo *FreepsExampleOperator) GetDefaultConfig() interface{}
func (*FreepsExampleOperator) GetDynamicArgSuggestions ¶
func (feo *FreepsExampleOperator) GetDynamicArgSuggestions(fn string, arg string, otherArgs FunctionArguments) map[string]string
func (*FreepsExampleOperator) GetDynamicFunctions ¶
func (feo *FreepsExampleOperator) GetDynamicFunctions() []string
func (*FreepsExampleOperator) GetDynamicPossibleArgs ¶
func (feo *FreepsExampleOperator) GetDynamicPossibleArgs(fn string) []string
func (*FreepsExampleOperator) GetHook ¶
func (feo *FreepsExampleOperator) GetHook() interface{}
func (*FreepsExampleOperator) InitCopyOfOperator ¶
func (feo *FreepsExampleOperator) InitCopyOfOperator(ctx *Context, config interface{}, fullOperatorName string) (FreepsOperatorWithConfig, error)
func (*FreepsExampleOperator) Shutdown ¶
func (feo *FreepsExampleOperator) Shutdown(ctx *Context)
func (*FreepsExampleOperator) StartListening ¶
func (feo *FreepsExampleOperator) StartListening(ctx *Context)
type FreepsFunctionMetaData ¶
type FreepsFunctionMetaData struct { FuncValue reflect.Value Name string FuncType FreepsFunctionType }
FreepsFunctionMetaData contains the reflect Value to the Function itself, the case sensitive name and the FreepsFunctionType
type FreepsFunctionParameters ¶
type FreepsFunctionParameters interface { // GetArgSuggestions returns a map of possible arguments for the given function and argument name GetArgSuggestions(operator FreepsOperator, fn string, argName string, otherArgs map[string]string) map[string]string // VerifyParameters checks if the given parameters are valid VerifyParameters(operator FreepsOperator) *OperatorIO }
FreepsFunctionParameters is the interface for a paramter struct that can return ArgumentSuggestions
type FreepsFunctionParametersWithInit ¶
type FreepsFunctionParametersWithInit interface {
Init(ctx *Context, operator FreepsOperator, fn string)
}
FreepsFunctionParametersWithInit adds the Init() method to FreepsFunctionParameters
type FreepsFunctionType ¶
type FreepsFunctionType int
FreepsFunctionType is an enum that indicates how many function parameters a compatible FreepsFunction has
const ( // FreepsFunctionTypeUnknown indicates that the function is not a FreepsFunction FreepsFunctionTypeUnknown FreepsFunctionType = iota // FreepsFunctionTypeSimple indicates that the function has no parameters FreepsFunctionTypeSimple // FreepsFunctionTypeContextOnly indicates that the function has a Context ptr as first parameter FreepsFunctionTypeContextOnly // FreepsFunctionTypeContextAndInput indicates that the function has a Context ptr as first parameter and a OperatorIO ptr as second parameter FreepsFunctionTypeContextAndInput // FreepsFunctionTypeWithDynamicFunctionArguments indicates that the function has a Context ptr as first parameter, a OperatorIO ptr as second parameter and FunctionArguments as third parameter FreepsFunctionTypeWithDynamicFunctionArguments // FreepsFunctionTypeWithArguments indicates that the function has a Context ptr as first parameter, a OperatorIO ptr as second parameter and a struct as third parameter FreepsFunctionTypeWithArguments // FreepsFunctionTypeFullSignature indicates that the function has a Context ptr as first parameter, a OperatorIO ptr as second parameter, a struct as third parameter and a map[string]string as fourth parameter FreepsFunctionTypeFullSignature )
type FreepsOperator ¶
type FreepsOperator interface { }
FreepsOperator is the interface structs need to implement so FreepsOperatorWrapper can create a FreepsOperator from them
type FreepsOperatorWithConfig ¶
type FreepsOperatorWithConfig interface { FreepsOperator // GetDefaultConfig returns a copy of the default config GetDefaultConfig() interface{} // InitCopyOfOperator creates a copy of the operator and initializes it with the given config InitCopyOfOperator(ctx *Context, config interface{}, fullOperatorName string) (FreepsOperatorWithConfig, error) }
FreepsOperatorWithConfig adds methods to support multiple configurations to FreepsOperator
type FreepsOperatorWithDynamicFunctions ¶
type FreepsOperatorWithDynamicFunctions interface { FreepsOperator // GetDynamicFunctions returns a list of functions that are dynamically added to the operator GetDynamicFunctions() []string // GetDynamicPossibleArgs returns a list of possible arguments for the given function GetDynamicPossibleArgs(fn string) []string // GetDynamicArgSuggestions returns a map of possible arguments for the given function and argument name GetDynamicArgSuggestions(fn string, arg string, otherArgs FunctionArguments) map[string]string // ExecuteDynamic executes the given function with the given arguments ExecuteDynamic(ctx *Context, fn string, mainArgs FunctionArguments, mainInput *OperatorIO) *OperatorIO }
FreepsOperatorWithDynamicFunctions adds methods to support dynamic functions to FreepsOperator
type FreepsOperatorWithHook ¶
type FreepsOperatorWithHook interface { FreepsOperator // GetHook returns the hook for this operator GetHook() interface{} }
FreepsOperatorWithShutdown adds the Shutdown() method to FreepsOperatorWithConfig
type FreepsOperatorWithShutdown ¶
type FreepsOperatorWithShutdown interface { FreepsOperator // StartListening is called when the graph engine is starting up StartListening(ctx *Context) // Shutdown is called when the graph engine is shutting down Shutdown(ctx *Context) }
FreepsOperatorWithShutdown adds the Shutdown() method to FreepsOperatorWithConfig
type FreepsOperatorWrapper ¶
type FreepsOperatorWrapper struct {
// contains filtered or unexported fields
}
FreepsOperatorWrapper creates everything necessary to be a FreepsBaseOperator from any struct that implements FreepsOperator
func (*FreepsOperatorWrapper) Execute ¶
func (o *FreepsOperatorWrapper) Execute(ctx *Context, function string, args map[string]string, mainInput *OperatorIO) *OperatorIO
Execute gets the FreepsFunction by name, assignes all parameters based on the args map and calls the function
func (*FreepsOperatorWrapper) GetArgSuggestions ¶
func (o *FreepsOperatorWrapper) GetArgSuggestions(function string, argName string, otherArgs map[string]string) map[string]string
GetArgSuggestions creates a Freepsfunction by name and returns the suggestions for the argument argName
func (*FreepsOperatorWrapper) GetCommonParameterSuggestions ¶
func (o *FreepsOperatorWrapper) GetCommonParameterSuggestions(parmStruct reflect.Value, paramName string) []string
GetCommonParameterSuggestions returns the default suggestions for the argument argName of type argType
func (*FreepsOperatorWrapper) GetConfig ¶
func (o *FreepsOperatorWrapper) GetConfig() interface{}
GetConfig returns the config of the operator
func (*FreepsOperatorWrapper) GetFunctions ¶
func (o *FreepsOperatorWrapper) GetFunctions() []string
GetFunctions returns all methods of the opClass
func (*FreepsOperatorWrapper) GetHook ¶
func (o *FreepsOperatorWrapper) GetHook() interface{}
GetHook returns the hook of the FreepsOperator if it exists
func (*FreepsOperatorWrapper) GetName ¶
func (o *FreepsOperatorWrapper) GetName() string
GetName returns the name of the struct opClass
func (*FreepsOperatorWrapper) GetPossibleArgs ¶
func (o *FreepsOperatorWrapper) GetPossibleArgs(fn string) []string
GetPossibleArgs returns all function parameters
func (*FreepsOperatorWrapper) SetOptionalFreepsFunctionParameters ¶
func (o *FreepsOperatorWrapper) SetOptionalFreepsFunctionParameters(freepsFuncParams reflect.Value, args map[string]string, failOnErr bool) *OperatorIO
SetOptionalFreepsFunctionParameters sets the parameters of the FreepsFunction based on the args map
func (*FreepsOperatorWrapper) SetRequiredFreepsFunctionParameters ¶
func (o *FreepsOperatorWrapper) SetRequiredFreepsFunctionParameters(freepsFuncParams reflect.Value, args map[string]string, failOnErr bool) *OperatorIO
SetRequiredFreepsFunctionParameters sets the parameters of the FreepsFunction based on the args map
func (*FreepsOperatorWrapper) Shutdown ¶
func (o *FreepsOperatorWrapper) Shutdown(ctx *Context)
Shutdown calls the Shutdown method of the FreepsOperator if it exists
func (*FreepsOperatorWrapper) StartListening ¶
func (o *FreepsOperatorWrapper) StartListening(ctx *Context)
StartListening calls the StartListening method of the FreepsOperator if it exists
type FunctionArguments ¶
FunctionArguments is a struct that can be used to pass arguments to a function
func MakeEmptyFunctionArguments ¶
func MakeEmptyFunctionArguments() FunctionArguments
func NewFunctionArguments ¶
func NewFunctionArguments(args map[string]string) FunctionArguments
type OperatorIO ¶
type OperatorIO struct { OutputType OutputT HTTPCode int Output interface{} ContentType string `json:",omitempty"` }
OperatorIO is the input and output of an operator, once created it should not be modified Note: the Store Operator depends on this struct being immutable
func MakeByteOutput ¶
func MakeByteOutput(output []byte) *OperatorIO
func MakeByteOutputWithContentType ¶
func MakeByteOutputWithContentType(output []byte, contentType string) *OperatorIO
func MakeEmptyOutput ¶
func MakeEmptyOutput() *OperatorIO
func MakeObjectOutput ¶
func MakeObjectOutput(output interface{}) *OperatorIO
func MakeObjectOutputWithContentType ¶
func MakeObjectOutputWithContentType(output interface{}, contentType string) *OperatorIO
func MakeOutputError ¶
func MakeOutputError(code int, msg string, a ...interface{}) *OperatorIO
func MakePlainOutput ¶
func MakePlainOutput(msg string) *OperatorIO
func MakeSprintfOutput ¶
func MakeSprintfOutput(msg string, a ...interface{}) *OperatorIO
func (*OperatorIO) GetArgsMap ¶
func (io *OperatorIO) GetArgsMap() (map[string]string, error)
func (*OperatorIO) GetBytes ¶
func (io *OperatorIO) GetBytes() ([]byte, error)
func (*OperatorIO) GetError ¶
func (io *OperatorIO) GetError() error
func (*OperatorIO) GetObject ¶
func (io *OperatorIO) GetObject() interface{}
func (*OperatorIO) GetSize ¶
func (io *OperatorIO) GetSize() (int, error)
func (*OperatorIO) GetStatusCode ¶
func (io *OperatorIO) GetStatusCode() int
func (*OperatorIO) GetString ¶
func (io *OperatorIO) GetString() string
func (*OperatorIO) IsEmpty ¶
func (io *OperatorIO) IsEmpty() bool
func (*OperatorIO) IsError ¶
func (io *OperatorIO) IsError() bool
func (*OperatorIO) IsFormData ¶
func (io *OperatorIO) IsFormData() bool
func (*OperatorIO) IsObject ¶
func (io *OperatorIO) IsObject() bool
func (*OperatorIO) IsPlain ¶
func (io *OperatorIO) IsPlain() bool
func (*OperatorIO) Log ¶
func (oio *OperatorIO) Log(logger logrus.FieldLogger)
func (*OperatorIO) ParseFormData ¶
func (io *OperatorIO) ParseFormData() (url.Values, error)
ParseFormData returns the data as posted by a HTML form
func (*OperatorIO) ParseJSON ¶
func (io *OperatorIO) ParseJSON(obj interface{}) error
func (*OperatorIO) ToString ¶
func (oio *OperatorIO) ToString() string