Codebase list golang-github-go-kit-kit / 048aff0 transport / awslambda / encode_decode.go
048aff0

Tree @048aff0 (Download .tar.gz)

encode_decode.go @048aff0raw · history · blame

package awslambda

import (
	"context"
)

// DecodeRequestFunc extracts a user-domain request object from an
// AWS Lambda payload.
type DecodeRequestFunc func(context.Context, []byte) (interface{}, error)

// EncodeResponseFunc encodes the passed response object into []byte,
// ready to be sent as AWS Lambda response.
type EncodeResponseFunc func(context.Context, interface{}) ([]byte, error)

// ErrorEncoder is responsible for encoding an error.
type ErrorEncoder func(ctx context.Context, err error) ([]byte, error)