{"modulePath":"github.com/jamillosantos/lambda","version":"v0.0.0-20241128203319-d96fe47cac13","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package lambda\n\n## Functions\n\n```go\nfunc Start[Req any, Resp any](handler Handler[Req, Resp], opts ...Option[Resp])\n```\nStart will start the lambda function with the given handler and httpOptions.\n\nStart should be used when not using http events.\n\n## Types\n\n```go\ntype Context[Req any] struct {\n\tContext context.Context\n\tRequest Req\n\tLocals  map[string]any\n}\n```\n\n```go\nfunc (l *Context[Req]) GetLocal(key string) (any, bool)\n```\n\n```go\nfunc (l *Context[Req]) SetLocal(key string, value any) *Context[Req]\n```\n\n```go\nfunc (l *Context[Req]) UnsetLocal(key string) *Context[Req]\n```\n\n```go\ntype Handler[Req any, Resp any] func(*Context[Req]) (Resp, error)\n```\n\n```go\nfunc Use[Req any, Resp any](handler Handler[Req, Resp], middlewares ...Middleware[Req, Resp]) Handler[Req, Resp]\n```\n\n```go\ntype Middleware[Req any, Resp any] func(ctx *Context[Req], next Handler[Req, Resp]) (Resp, error)\n```\n\n```go\ntype None struct{}\n```\nNone is an empty struct used when we are not interested on the request or response body.\n\n```go\ntype Option[Resp any] func(*options[Resp])\n```\n\n```go\nfunc WithErrorHandler[Resp any](h func(error) (Resp, error)) Option[Resp]\n```\nWithErrorHandler is an option that allows you to pass a custom error handler to the lambda function.\n\n```go\nfunc WithResources[Resp any](r ...Resource) Option[Resp]\n```\nWithResources is an option that allows you to pass resources to the lambda function.\n\n```go\ntype Resource interface {\n\tName() string\n\tStart(context.Context) error\n}\n```\nResource is an interface that represents a resource that can be started and stopped. Example: A connection to the database or message broker, etc;\n\n","path":"github.com/jamillosantos/lambda","name":"lambda","synopsis":"","isRedistributable":true}
