Documentation ¶
Index ¶
- func FailOnError(err error, msg string)
- func ParseUInt(stringToParse string) (uint, error)
- func ParseUInt64(stringToParse string) (uint64, error)
- func RandomString10() string
- func ReadJSON(w http.ResponseWriter, r *http.Request, v interface{}) error
- func ReadValidateJSON(w http.ResponseWriter, r *http.Request, v interface{}) error
- func WriteErrorJSON(w http.ResponseWriter, status int, message string)
- func WriteJSON(w http.ResponseWriter, status int, v interface{})
- type StatusResponse
- type Validable
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseUInt64 ¶
ParseUInt64 helper to avoid code repetition
func RandomString10 ¶
func RandomString10() string
RandomString10 returns a random 10 characters string
func ReadJSON ¶
func ReadJSON(w http.ResponseWriter, r *http.Request, v interface{}) error
ReadJSON reads a json payload and unmarshal it to an interface
func ReadValidateJSON ¶
func ReadValidateJSON(w http.ResponseWriter, r *http.Request, v interface{}) error
ReadValidateJSON reads a json payload and unmarshal it to an interface and validates it
func WriteErrorJSON ¶
func WriteErrorJSON(w http.ResponseWriter, status int, message string)
WriteErrorJSON writes a json error
func WriteJSON ¶
func WriteJSON(w http.ResponseWriter, status int, v interface{})
WriteJSON writes json value
Types ¶
type StatusResponse ¶
type StatusResponse struct { Status string `json:"status"` Message string `json:"message,omitempty"` }
StatusResponse is a status response model
Click to show internal directories.
Click to hide internal directories.