lambda

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoInput        = fmt.Errorf("no input")
	ErrNoFunctionName = fmt.Errorf("no function name")
)
View Source
var (
	StatusCode202 int64 = 202
)

Functions

This section is empty.

Types

type Fake

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

Fake presents a fake lambda that keep mapping between function name and handler

func NewFakeLambda

func NewFakeLambda(opts ...Option) *Fake

NewFakeLambda creates a new fake lambda

func (*Fake) Invoke

func (f *Fake) Invoke(in *real.InvokeInput) (out *real.InvokeOutput, err error)

Invoke invokes the lambda function-same signature as real lambda

func (*Fake) InvokeWithContext

func (f *Fake) InvokeWithContext(ctx context.Context, in *real.InvokeInput, opts ...request.Option) (*real.InvokeOutput, error)

InvokeWithContext invokes the lambda function-same signature as real lambda

type FuncHandler

type FuncHandler func(ctx context.Context, input []byte) ([]byte, error)

FuncHandler is a longest function as the input for lambda. present for func (context.Context, TIn) (TOut, error) If you do not need to use input or output, just ignore it

type Option

type Option func(f *Fake)

Option add option for Fake

func WithFunction

func WithFunction(name string, handler FuncHandler) Option

WithFunction register a function with Fake

Jump to

Keyboard shortcuts

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