lambdautils

package
v0.0.0-...-f8b903c Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2026 License: Apache-2.0 Imports: 9 Imported by: 5 modules, 5 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Utils for making AWS Lambda & API Gateway usage easier

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InLambda

func InLambda() bool

AWS Lambda doesn't support giving argv, so we use an ugly hack to detect it

func NewLambdaHttpHandlerAdapter

func NewLambdaHttpHandlerAdapter(httpHandler http.Handler) lambda.Handler

adapts lambda.Handler to Go's http.Handler by translating between API gateway request/responses

func NewMultiEventTypeHandler

func NewMultiEventTypeHandler(fn multiEventTypeHandlerFn) lambda.Handler

func ServeApiGatewayProxyRequestUsingHttpHandler

func ServeApiGatewayProxyRequestUsingHttpHandler(
	ctx context.Context,
	proxyRequest *events.APIGatewayProxyRequest,
	httpHandler http.Handler,
) ([]byte, error)

github.com/akrylysov/algnhsa has similar implementation than apex/gateway, but had the useful bits non-exported and it used httptest for production code

Types

type LambdaHttpHandlerAdapter

type LambdaHttpHandlerAdapter struct {
	// contains filtered or unexported fields
}

higher level handler adapter. ServeApiGatewayProxyRequestUsingHttpHandler() is lower if you need to be able to give APIGatewayProxyRequest and get back byte slice & error

func (*LambdaHttpHandlerAdapter) Invoke

func (m *LambdaHttpHandlerAdapter) Invoke(ctx context.Context, payload []byte) ([]byte, error)

type NoPayloadAdapter

type NoPayloadAdapter func(context.Context) error

simple function as a Lambda handler by discarding input payload and returning empty payload. this is available in AWS's lambda.Start(handler interface{}) but it's not typesafe (runtime error if fn sig doesn't match)

func (NoPayloadAdapter) Invoke

func (s NoPayloadAdapter) Invoke(ctx context.Context, payload []byte) ([]byte, error)

Jump to

Keyboard shortcuts

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