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: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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