stdlambda

package
v0.0.148 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package stdlambda implements re-usable logic for AWS Lambda that is not tied to fx.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HandlerFunc added in v0.0.47

type HandlerFunc func(ctx context.Context, payload []byte) ([]byte, error)

HandlerFunc implements lambda.Handler, similar to http.HandlerFunc.

func (HandlerFunc) Invoke added in v0.0.47

func (f HandlerFunc) Invoke(ctx context.Context, payload []byte) ([]byte, error)

type Invoker added in v0.0.46

type Invoker[I, O any] struct {
	// contains filtered or unexported fields
}

Invoker invokes a lambda using "I" as the input type and "O" as the output type.

func NewInvoker added in v0.0.46

func NewInvoker[I, O any](lambdaClient Lambda, functionName string) *Invoker[I, O]

NewInvoker inits the invoker.

func (Invoker[I, O]) Invoke added in v0.0.46

func (inv Invoker[I, O]) Invoke(ctx context.Context, input I) (output *O, err error)

Invoke invokes the lambda function.

type JSONHandlerFunc added in v0.0.49

type JSONHandlerFunc[
	I, O any] func(ctx context.Context, payload I) (O, error)

JSONHandlerFunc implements lambda.Handler but decodes and encodes as JSON.

func (JSONHandlerFunc[I, O]) Invoke added in v0.0.49

func (f JSONHandlerFunc[I, O]) Invoke(ctx context.Context, payload []byte) ([]byte, error)

type Lambda added in v0.0.46

type Lambda interface {
	Invoke(ctx context.Context, params *lambda.InvokeInput, optFns ...func(*lambda.Options)) (*lambda.InvokeOutput, error)
}

Lambda is implemented by the official SDK's client.

type ProtoInvoker added in v0.0.46

type ProtoInvoker[I, O any, IP interface {
	*I
	proto.Message
}, OP interface {
	*O
	proto.Message
}] struct {
	// contains filtered or unexported fields
}

ProtoInvoker invokes lambdas that use protobuf encoding.

func NewProtoInvoker added in v0.0.46

func NewProtoInvoker[I, O any, IP interface {
	*I
	proto.Message
}, OP interface {
	*O
	proto.Message
}](lambdaClient Lambda, functionName string) *ProtoInvoker[I, O, IP, OP]

NewProtoInvoker inits the invoker.

func (ProtoInvoker[I, O, IP, OP]) Invoke added in v0.0.46

func (inv ProtoInvoker[I, O, IP, OP]) Invoke(ctx context.Context, input IP) (output OP, err error)

Invoke invokes the lambda function but encodes it using protobuf JSON.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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