{"modulePath":"github.com/Luke-Davies/aws-lambda-go","version":"v0.0.0-20230403225755-6c0fb1d8bc46","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package lambda\n\n## Functions\n\n```go\nfunc StartHandlerFunc[TIn any, TOut any, H HandlerFunc[TIn, TOut]](handler H, options ...Option)\n```\nStartHandlerFunc is the same as StartWithOptions except that it takes a generic input so that the function signature can be validated at compile time.\n\n## Types\n\n```go\ntype Function struct {\n\t// contains filtered or unexported fields\n}\n```\nFunction struct which wrap the Handler\n\nDeprecated: The Function type is public for the go1.x runtime internal use of the net/rpc package\n\n```go\nfunc NewFunction(handler *handlerOptions) *Function\n```\nNewFunction which creates a Function with a given Handler\n\nDeprecated: The Function type is public for the go1.x runtime internal use of the net/rpc package\n\n```go\nfunc (fn *Function) Invoke(req *messages.InvokeRequest, response *messages.InvokeResponse) error\n```\nInvoke method try to perform a command given an InvokeRequest and an InvokeResponse\n\n```go\nfunc (fn *Function) Ping(req *messages.PingRequest, response *messages.PingResponse) error\n```\nPing method which given a PingRequest and a PingResponse parses the PingResponse\n\n```go\ntype Handler interface {\n\tInvoke(ctx context.Context, payload []byte) ([]byte, error)\n}\n```\n\n```go\ntype HandlerFunc[TIn, TOut any] interface {\n\tfunc(context.Context, TIn) (TOut, error)\n}\n```\nHandlerFunc represents a valid input with two arguments and two returns as described by Start\n\n```go\ntype Option func(*handlerOptions)\n```\n\n```go\nfunc WithContext(ctx context.Context) Option\n```\nWithContext is a HandlerOption that sets the base context for all invocations of the handler.\n\nUsage:\n\n\tlambda.StartWithOptions(\n\t \tfunc (ctx context.Context) (string, error) {\n\t \t\treturn ctx.Value(\"foo\"), nil\n\t \t},\n\t \tlambda.WithContext(context.WithValue(context.Background(), \"foo\", \"bar\"))\n\t)\n\n```go\nfunc WithEnableSIGTERM(callbacks ...func()) Option\n```\nWithEnableSIGTERM enables SIGTERM behavior within the Lambda platform on container spindown. SIGKILL will occur ~500ms after SIGTERM. Optionally, an array of callback functions to run on SIGTERM may be provided.\n\nUsage:\n\n\tlambda.StartWithOptions(\n\t    func (event any) (any, error) {\n\t\t\treturn event, nil\n\t\t},\n\t\tlambda.WithEnableSIGTERM(func() {\n\t\t\tlog.Print(\"function container shutting down...\")\n\t\t})\n\t)\n\n```go\nfunc WithSetEscapeHTML(escapeHTML bool) Option\n```\nWithSetEscapeHTML sets the SetEscapeHTML argument on the underlying json encoder\n\nUsage:\n\n\tlambda.StartWithOptions(\n\t\tfunc () (string, error) {\n\t\t\treturn \"\u003chtml\u003e\u003cbody\u003ehello!\u003e\u003c/body\u003e\u003c/html\u003e\", nil\n\t\t},\n\t\tlambda.WithSetEscapeHTML(true),\n\t)\n\n```go\nfunc WithSetIndent(prefix, indent string) Option\n```\nWithSetIndent sets the SetIndent argument on the underling json encoder\n\nUsage:\n\n\tlambda.StartWithOptions(\n\t\tfunc (event any) (any, error) {\n\t\t\treturn event, nil\n\t\t},\n\t\tlambda.WithSetIndent(\"\u003e\",\" \"),\n\t)\n\n","path":"github.com/Luke-Davies/aws-lambda-go/lambda","name":"lambda","synopsis":"","isRedistributable":true}
