Documentation
¶
Index ¶
- Constants
- func DecodeBodyJSON(r *http.Request, v interface{}, logger *logger.Logger) error
- func JSONResponse(w http.ResponseWriter, code int, message string)
- func Respond(w http.ResponseWriter, r *http.Request, status int, data interface{})
- func RespondErro(w http.ResponseWriter, r *http.Request, status int, errMsg *ErrMessage)
- func Router() *mux.Router
- type ErrDetail
- type ErrMessage
- type SuccessMessage
Constants ¶
View Source
const ( ErrorReadAllBuffer = "ErrorReadAllBuffer" ErrorJSONUnmarshal = "ErrorJSONUnmarshal" )
Possibles errors type
Variables ¶
This section is empty.
Functions ¶
func DecodeBodyJSON ¶
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
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 ...
Click to show internal directories.
Click to hide internal directories.