dynamodb

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context struct {
	Context     context.Context
	EventRecord events.DynamoDBEventRecord
}

func (*Context) BindKeys

func (c *Context) BindKeys(out interface{}) error

func (*Context) BindNewImage

func (c *Context) BindNewImage(out interface{}) error

func (*Context) BindOldImage

func (c *Context) BindOldImage(out interface{}) error

type HandlerFunc

type HandlerFunc func(c *Context) error

func (HandlerFunc) Middleware

func (hf HandlerFunc) Middleware(middleware ...Middleware) HandlerFunc

Apply middleware to the handler func.

Middleware is called in the order it is given to this function.

func (HandlerFunc) Start

func (hf HandlerFunc) Start()

func (HandlerFunc) ToLambdaHandler

func (hf HandlerFunc) ToLambdaHandler() func(ctx context.Context, event events.DynamoDBEvent) error

Get the AWS Lambda handler of the handler func.

Useful if you need to call AWS lambda.Start(...) directly, not required in most cases.

type Middleware

type Middleware func(h HandlerFunc) HandlerFunc

func CorrelationIDMiddleware

func CorrelationIDMiddleware() Middleware

Middleware to attach a correlation ID to the event, useful for tracing requests through distributed systems if it is passed along in further requests. You can also access the correlation ID directly in your handlers and middlewares by calling log.CorrelationIDFromContext(c.Context).

If used with the LoggerMiddleware, Correlation IDs are logged in each message. To ensure logs have correlation ID field, this middleware should be called first.

func LoggerMiddleware

func LoggerMiddleware(w io.Writer, fields map[string]string) Middleware

Middleware to configure a logger in the context.Context.

The middleware logs on each event handled, and on errors. In addition to the default log messages, you can access the logger in your handlers/middleware by calling log.LoggerFromContext(c.Context). The logger we use is github.com/rs/zerolog

w io.Writer is the log output, for example os.Stdout field map[string]string is a list of key value fields to include in each log message

Jump to

Keyboard shortcuts

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