core

package
v0.0.0-...-4489571 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrorReadAllBuffer = "ErrorReadAllBuffer"
	ErrorJSONUnmarshal = "ErrorJSONUnmarshal"
)

Possibles errors type

Variables

This section is empty.

Functions

func DecodeBodyJSON

func DecodeBodyJSON(r *http.Request, v interface{}, logger *logger.Logger) error

DecodeBodyJSON ...

func JSONResponse

func JSONResponse(w http.ResponseWriter, code int, message string)

JSONResponse: This method return one message in TEXT PLAIN format Ex: JSONResponse(w, http.StatusBadRequest, "One ou more fields has not been informed...")

func Respond

func Respond(w http.ResponseWriter, r *http.Request, status int, data interface{})

Respond: This method return one message in JSON format

func RespondErro

func RespondErro(w http.ResponseWriter, r *http.Request, status int, errMsg *ErrMessage)

RespondErro: This method return one error message in JSON format

func Router

func Router() *mux.Router

Router ...

Types

type ErrDetail

type ErrDetail struct {
	Resource string `json:"resource"`
	Code     string `json:"code"`
	Message  string `json:"message"`
}

ErrDetail ...

type ErrMessage

type ErrMessage struct {
	Message string `json:"message"`
	Code    string `json:"code"`
	Erro    string `json:"erro"`
}

ErrMessage is return message default

type SuccessMessage

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

SuccessMessage ...

Jump to

Keyboard shortcuts

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