mid

package
v0.0.0-...-da924b9 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Encoder

type Encoder interface {
	Encode() (data []byte, contentType string, err error)
}

Encoder defines behavior that can encode a data model and provide the content type for that encoding.

func Errors

func Errors(ctx context.Context, log *logger.Logger, next Handler) (Encoder, error)

Errors handles errors coming out of the call chain. It detects normal application errors which are used to respond to the client in a uniform way. Unexpected errors (status >= 500) are logged.

func Logger

func Logger(ctx context.Context, log *logger.Logger, path string, rawQuery string, method string, remoteAddr string, next Handler) (Encoder, error)

Logger writes information about the request to the logs.

func Panics

func Panics(ctx context.Context, next Handler) (resp Encoder, err error)

Panics recovers from panics and converts the panic to an error so it is reported in Metrics and handled in Errors.

type Handler

type Handler func(context.Context) (Encoder, error)

Handler represents an api layer handler function that needs to be called.

Jump to

Keyboard shortcuts

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