mif

package module
v0.0.0-...-2122fe9 Latest Latest
Warning

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

Go to latest
Published: May 12, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JSONConfig

type JSONConfig struct {
	Prefix string
	Indent string
}

JSON Config

type JSONData

type JSONData struct {
	NotJSON bool
	Header  http.Header
	Status  int
	Data    interface{}
}

type Logger

type Logger interface {
	Error(args ...interface{})
}

Logger

type MIF

type MIF interface {
	Simple(next SimpleFunc) http.HandlerFunc
	Wrap(next WrapFunc) http.HandlerFunc
	WrapJSON(next WrapJSONFunc) http.HandlerFunc
}

func New

func New(opts ...Option) MIF

type Option

type Option interface {
	// contains filtered or unexported methods
}

func SetDisablePanic

func SetDisablePanic() Option

func WithJSONConfig

func WithJSONConfig(cfg JSONConfig) Option

func WithLogger

func WithLogger(logger Logger) Option

func WithNoopLogger

func WithNoopLogger() Option

func WithStdLogger

func WithStdLogger(logger StdLogger) Option

type RawData

type RawData struct {
	Header http.Header
	Status int
	Raw    []byte
}

type SimpleFunc

type SimpleFunc func(w http.ResponseWriter, r *http.Request) error

type StdLogger

type StdLogger interface {
	Println(args ...interface{})
}

Std Logger

type UserError

type UserError struct {
	Message string `json:"error_message"`
}

type WrapFunc

type WrapFunc func(r *http.Request) (*RawData, error)

type WrapJSONFunc

type WrapJSONFunc func(r *http.Request) (*JSONData, error)

Jump to

Keyboard shortcuts

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