Documentation ¶
Overview ¶
Lambda Handler Data Structures and types
Index ¶
- func CallHandler(reflection TaskReflection, ctx context.Context, input []byte) (ret interface{}, err error)
- func CallHandlerFunction(handlerSymbol interface{}, ctx context.Context, input interface{}) (interface{}, error)
- func CreateHandler(tm *TaskHandlers) (func(context context.Context, input *RawMessage) (interface{}, error), error)
- func ValidateHandler(handlerSymbol interface{}) error
- type RawMessage
- type TaskError
- type TaskHandlers
- type TaskReflection
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CallHandler ¶
func CallHandler(reflection TaskReflection, ctx context.Context, input []byte) (ret interface{}, err error)
CallHandler calls a TaskReflections Handler with the correct objects using reflection Mostly borrowed from the aws-lambda-go package
func CallHandlerFunction ¶
func CallHandlerFunction(handlerSymbol interface{}, ctx context.Context, input interface{}) (interface{}, error)
CallHandlerFunction does reflection inline and should only be used for testing
func CreateHandler ¶
func CreateHandler(tm *TaskHandlers) (func(context context.Context, input *RawMessage) (interface{}, error), error)
CreateHandler returns the handler passed to the lambda.Start function
func ValidateHandler ¶
func ValidateHandler(handlerSymbol interface{}) error
ValidateHandler checks a handler is a function with the correct arguments and return values
Types ¶
type RawMessage ¶
type RawMessage struct { Task *string Input json.RawMessage // contains filtered or unexported fields }
RawMessage is the struct passed to the Lambda Handler It contains the name of the Task and the Inputs Raw message
func (*RawMessage) UnmarshalJSON ¶
func (message *RawMessage) UnmarshalJSON(data []byte) error
type TaskError ¶
TaskError is a error type a task function may throw handling it in the state machine is a good idea
type TaskHandlers ¶
type TaskHandlers map[string]interface{}
TaskHandlers maps a Task Name String to a function <pre>ahsufasiu</pre>
func (*TaskHandlers) Reflect ¶
func (t *TaskHandlers) Reflect() map[string]TaskReflection
TaskHandlers Returns a map of TaskReflections from TaskHandlers
func (*TaskHandlers) Tasks ¶
func (t *TaskHandlers) Tasks() []string
Tasks returns all Task names from a TaskHandlers Map
func (*TaskHandlers) Validate ¶
func (t *TaskHandlers) Validate() error
TaskHandlers validates all handlers in a TaskHandlers map
type TaskReflection ¶
TaskReflection caches lots of the reflected values from the Task functions in order to speed up calls
func CreateTaskReflection ¶
func CreateTaskReflection(handlerSymbol interface{}) TaskReflection
CreateTaskReflection creates a TaskReflection from a handler function