Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RespondJSON ¶
func RespondJSON(w *gin.Context, status int, message string, payload interface{}, errors interface{})
RespondJSON : send a proper response json to the client
func SetFirstLetterToLowerCase ¶
SetFirstLetterToLowerCase : Function to set first letter of string to lower case. This function exist because struct field name must start with capital letter This function is useful so the front end can detect which field has an error
Types ¶
type ErrorField ¶
type ErrorField struct { ID string `json:"id"` Value string `json:"value"` Caused string `json:"caused"` Message string `json:"message"` }
ErrorField : 422 error validation format
func ConstructErrors ¶
func ConstructErrors(err error) []ErrorField
ConstructErrors : Function to construct errors to be used in response
type ResponseData ¶
type ResponseData struct { Success bool `json:"success"` Message string `json:"message"` Data interface{} `json:"data"` Error interface{} `json:"error"` }
ResponseData : response format
Click to show internal directories.
Click to hide internal directories.