lamway

package module
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2024 License: MIT Imports: 9 Imported by: 0

README

Lamway

Is a manage layer implementation for AWS Lambda functions using API Gateway v1 or v2.

It provides a way to use go base http.Handler instances to manage all needed HTTP paths on the same lambda.

Requirements

  • Go >= 1.20

Installation

go get github.com/danteay/lamway

Example

Credits

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidAPIGatewayRequest = errors.New("gateway: invalid APIGateway request struct configured")
)

Functions

This section is empty.

Types

type Gateway

type Gateway[T any] struct {
	// contains filtered or unexported fields
}

Gateway wrap a http handler to enable use as a lambda.Handler

func New

func New[T any](opts ...Option) *Gateway[T]

New creates a gateway using the provided http.Handler enabling use in existing aws-lambda-go projects

func (*Gateway[T]) GetInvoker

func (gw *Gateway[T]) GetInvoker() any

GetInvoker returns the function that will be invoked by the lambda.Start call in main function. This funtion will be decorated or not depending on the options passed to the New function.

func (*Gateway[T]) Start

func (gw *Gateway[T]) Start() (err error)

type Logger added in v0.0.3

type Logger interface {
	Debugf(format string, args ...any)
}

type Option

type Option func(*options)

func WithDecorator

func WithDecorator(d types.Decorator) Option

func WithDefaultErrorHeaders

func WithDefaultErrorHeaders(headers map[string]string) Option

func WithDefaultErrorResponse

func WithDefaultErrorResponse(res string) Option

func WithHTTPHandler

func WithHTTPHandler(h http.Handler) Option

func WithLogger added in v0.0.3

func WithLogger(l Logger) Option

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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