json

package
v0.1.3-0...-08ec195 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2018 License: BSD-4-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// 200
	ResponseOK             = ResponseMessage(http.StatusText(http.StatusOK))
	ResponsePartialContent = ResponseMessage(http.StatusText(http.StatusPartialContent))

	// 300
	ResponseMovedPermanently  = ResponseMessage(http.StatusText(http.StatusMovedPermanently))
	ResponseFound             = ResponseMessage(http.StatusText(http.StatusFound))
	ResponseSeeOther          = ResponseMessage(http.StatusText(http.StatusSeeOther))
	ResponseTemporaryRedirect = ResponseMessage(http.StatusText(http.StatusTemporaryRedirect))
	ResponsePermanentRedirect = ResponseMessage(http.StatusText(http.StatusPermanentRedirect))
	ResponseUnauthorized      = ResponseMessage(http.StatusText(http.StatusUnauthorized))
	ResponsePaymentRequired   = ResponseMessage(http.StatusText(http.StatusPaymentRequired))

	// 400
	ResponseBadRequest                  = ResponseMessage(http.StatusText(http.StatusBadRequest))
	ResponseForbidden                   = ResponseMessage(http.StatusText(http.StatusForbidden))
	ResponseNotFound                    = ResponseMessage(http.StatusText(http.StatusNotFound))
	ResponseMethodNotAllowed            = ResponseMessage(http.StatusText(http.StatusMethodNotAllowed))
	ResponseNotAcceptable               = ResponseMessage(http.StatusText(http.StatusNotAcceptable))
	ResponseRequestTimeout              = ResponseMessage(http.StatusText(http.StatusRequestTimeout))
	ResponseConflict                    = ResponseMessage(http.StatusText(http.StatusConflict))
	ResponseGone                        = ResponseMessage(http.StatusText(http.StatusGone))
	ResponsePreconditionFailed          = ResponseMessage(http.StatusText(http.StatusPreconditionFailed))
	ResponseRequestEntityTooLarge       = ResponseMessage(http.StatusText(http.StatusRequestEntityTooLarge))
	ResponseRequestURITooLong           = ResponseMessage(http.StatusText(http.StatusRequestURITooLong))
	ResponseUnsupportedMediaType        = ResponseMessage(http.StatusText(http.StatusUnsupportedMediaType))
	ResponseUpgradeRequired             = ResponseMessage(http.StatusText(http.StatusUpgradeRequired))
	ResponsePreconditionRequired        = ResponseMessage(http.StatusText(http.StatusPreconditionRequired))
	ResponseTooManyRequests             = ResponseMessage(http.StatusText(http.StatusTooManyRequests))
	ResponseRequestHeaderFieldsTooLarge = ResponseMessage(http.StatusText(http.StatusRequestHeaderFieldsTooLarge))
	ResponseUnavailableForLegalReasons  = ResponseMessage(http.StatusText(http.StatusUnavailableForLegalReasons))

	// 500
	ResponseInternalServerError     = ResponseMessage(http.StatusText(http.StatusInternalServerError))
	ResponseNotImplemented          = ResponseMessage(http.StatusText(http.StatusNotImplemented))
	ResponseBadGateway              = ResponseMessage(http.StatusText(http.StatusBadGateway))
	ResponseServiceUnavailable      = ResponseMessage(http.StatusText(http.StatusServiceUnavailable))
	ResponseGatewayTimeout          = ResponseMessage(http.StatusText(http.StatusGatewayTimeout))
	ResponseHTTPVersionNotSupported = ResponseMessage(http.StatusText(http.StatusHTTPVersionNotSupported))
	ResponseInsufficientStorage     = ResponseMessage(http.StatusText(http.StatusInsufficientStorage))
)
View Source
var (
	JSONConfig = json.ConfigFastest
)

Functions

func DumpJSON

func DumpJSON(w http.ResponseWriter, code int, serializable interface{})

func DumpJSONData

func DumpJSONData(serializable interface{}) ([]byte, error)

func LoadJSON

func LoadJSON(data []byte, deserializable interface{}) (err error)

func LoadJSONReader

func LoadJSONReader(r io.Reader, deserializable interface{}) (err error)

Types

type ResponseMessage

type ResponseMessage string

func (ResponseMessage) MarshalJSON

func (rm ResponseMessage) MarshalJSON() ([]byte, error)

Jump to

Keyboard shortcuts

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