rest

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2020 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseJson

func ParseJson(input io.ReadCloser, result interface{}) error

func WriteJson

func WriteJson(w http.ResponseWriter, object interface{}) error

Types

type Error

type Error struct {
	Code    int
	Message string
	Error   error
}

func NewParseJsonError

func NewParseJsonError(err error) *Error

func NewWriteJsonError

func NewWriteJsonError(err error) *Error

type ErrorJson

type ErrorJson struct {
	Error ErrorPayload `json:"error"`
}

func NewErrorJson

func NewErrorJson(message string) ErrorJson

type ErrorPayload

type ErrorPayload struct {
	Message string `json:"message"`
}

type Handler

type Handler struct {
	Logger  *zap.Logger
	Handler HandlerFunc
}

func (Handler) ServeHTTP

func (a Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type HandlerFunc

type HandlerFunc func(http.ResponseWriter, *http.Request) *Error

type Server

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

func NewServer

func NewServer(logger *zap.Logger) Server

func (*Server) NewHandler

func (s *Server) NewHandler(handler HandlerFunc) Handler

Jump to

Keyboard shortcuts

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