{"modulePath":"github.com/d-velop/dvelop-sdk-go/lambda","version":"v0.0.0-20260407070941-920eae18026d","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package lambda\n\nPackage lambda provides a kind of http server emulator for lambda functions. That is an adapter which translates an incoming AWS APIGatewayProxyRequests to a regular http.Request and an outgoing http response to a AWS APIGatewayProxyResponse\n\nThe use case are http applications which should be packaged and deployed as lambda functions and possibly at the same time as a normal local executable webapplication. So appart from this adapter function the rest of the application is unaware of the fact that it runs as a lambda function.\n\nSo instead of\n\n\tfunc main(){\n\t\t//...\n\t\thttp.Serve (socket, handler)\n\t}\n\nfor a regular http server\n\n\tfunc main(){\n\t\t//...\n\t\tlambda.Serve (handler, logerror, loginfo)\n\t}\n\ncan be used to serve http applications from lambda functions\n\n## Functions\n\n```go\nfunc AdaptorFunc(handler http.Handler, logerror, loginfo func(ctx context.Context, logmessage string)) func(ctx context.Context, request events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error)\n```\nAdaptorFunc adapts a regular http.Handler to an AWS lambda handler\n\n```go\nfunc AddReqIdToCtx(ctx context.Context, reqId string) context.Context\n```\nAddReqIdToCtx adds the lambda request ID to the context\n\n```go\nfunc GetAliasFromRequest(req http.Request) string\n```\n\n```go\nfunc ReqIdFromCtx(ctx context.Context) (string, error)\n```\nReqIdFromCtx reads the lambda request ID from the context\n\n```go\nfunc Serve(handler http.Handler, logerror, loginfo func(ctx context.Context, logmessage string))\n```\nServe uses a regular http.Handler to serve AWS APIGatewayProxyRequests\n\nExample:\n\n\tfunc main(){\n\t\t//...\n\t\tlambda.Serve (handler, logerror, loginfo)\n\t}\n\n","path":"github.com/d-velop/dvelop-sdk-go/lambda","name":"lambda","synopsis":"Package lambda provides a kind of http server emulator for lambda functions.","isRedistributable":true}
