{"modulePath":"github.com/grumpy-programmer/aws-lambda-go","version":"v1.10.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package lambda\n\n## Functions\n\n```go\nfunc Start(handler interface{})\n```\nStart takes a handler and talks to an internal Lambda endpoint to pass requests to the handler. If the handler does not match one of the supported types an appropriate error message will be returned to the caller. Start blocks, and does not return after being called.\n\nRules:\n\n  - handler must be a function\n  - handler may take between 0 and two arguments.\n  - if there are two arguments, the first argument must satisfy the \"context.Context\" interface.\n  - handler may return between 0 and two arguments.\n  - if there are two return values, the second argument must be an error.\n  - if there is one return value it must be an error.\n\nValid function signatures:\n\n\tfunc ()\n\tfunc () error\n\tfunc (TIn) error\n\tfunc () (TOut, error)\n\tfunc (TIn) (TOut, error)\n\tfunc (context.Context) error\n\tfunc (context.Context, TIn) error\n\tfunc (context.Context) (TOut, error)\n\tfunc (context.Context, TIn) (TOut, error)\n\nWhere \"TIn\" and \"TOut\" are types compatible with the \"encoding/json\" standard library. See [https://golang.org/pkg/encoding/json/#Unmarshal](https://golang.org/pkg/encoding/json/#Unmarshal) for how deserialization behaves\n\n```go\nfunc StartHandler(handler Handler)\n```\nStartHandler takes in a Handler wrapper interface which can be implemented either by a custom function or a struct.\n\nHandler implementation requires a single \"Invoke()\" function:\n\n\tfunc Invoke(context.Context, []byte) ([]byte, error)\n\n## Types\n\n```go\ntype Function struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc (fn *Function) Invoke(req *messages.InvokeRequest, response *messages.InvokeResponse) error\n```\n\n```go\nfunc (fn *Function) Ping(req *messages.PingRequest, response *messages.PingResponse) error\n```\n\n```go\ntype Handler interface {\n\tInvoke(ctx context.Context, payload []byte) ([]byte, error)\n}\n```\n\n```go\nfunc NewHandler(handlerFunc interface{}) Handler\n```\nNewHandler creates a base lambda handler from the given handler function. The returned Handler performs JSON deserialization and deserialization, and delegates to the input handler function.  The handler function parameter must satisfy the rules documented by Start.  If handlerFunc is not a valid handler, the returned Handler simply reports the validation error.\n\n","path":"github.com/grumpy-programmer/aws-lambda-go/lambda","name":"lambda","synopsis":"","isRedistributable":true}
