nodewrapper

package
v0.0.0-...-1b1f3b4 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2017 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(handler Handler, rawOutput bool)

func RunStream

func RunStream(handler Handler, Stdin io.Reader, Stdout io.Writer, rawOutput bool)

Types

type Context

type Context struct {
	AwsRequestID             string `json:"awsRequestId"`
	FunctionName             string `json:"functionName"`
	FunctionVersion          string `json:"functionVersion"`
	Invokeid                 string `json:"invokeid"`
	IsDefaultFunctionVersion bool   `json:"isDefaultFunctionVersion"`
	LogGroupName             string `json:"logGroupName"`
	LogStreamName            string `json:"logStreamName"`
	MemoryLimitInMB          string `json:"memoryLimitInMB"`
}

type Handler

type Handler func(*Context, json.RawMessage) (interface{}, error)

type Payload

type Payload struct {
	// custom event fields
	Event json.RawMessage `json:"event"`

	// default context object
	Context *Context `json:"context"`
}

type Response

type Response struct {
	// Request id is an incremental integer
	// representing the request that has been
	// received by this go proc during it's
	// lifetime
	Success   *bool `json:"success,omitempty"`
	RequestId int   `json:"-"` // can retrun request_id for debugging"`
	// Any errors that occur during processing
	// or are returned by handlers are returned
	Error *string `json:"errorMessage,omitempty"`
	Token *string `json:"token,omitempty"`
	// Response output data returned if no errors are present
	Data *interface{} `json:"response,omitempty"`
}

func NewErrorResponse

func NewErrorResponse(err error) *Response

func NewResponse

func NewResponse(data interface{}) *Response

Jump to

Keyboard shortcuts

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