Documentation ¶
Index ¶
- func GetLimitAndOffset(r *http.Request) (limit int, offset int)
- func RespondError(w http.ResponseWriter, err error)
- func RespondErrorMessage(w http.ResponseWriter, code int, msg string)
- func RespondJSON(w http.ResponseWriter, code int, payload interface{})
- func RespondJSONWithXTotalCount(w http.ResponseWriter, code int, count int, payload interface{})
- func SetNewHeader(w http.ResponseWriter, headerName, value string)
- func UnmarshalJSON(request *http.Request, out interface{}) error
- type Parser
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetLimitAndOffset ¶
GetLimitAndOffset gets and returns the limit and offset from the given request.
func RespondError ¶
func RespondError(w http.ResponseWriter, err error)
RespondError check error type and Write to ResponseWriter.
func RespondErrorMessage ¶
func RespondErrorMessage(w http.ResponseWriter, code int, msg string)
RespondErrorMessage make error response with payload.
func RespondJSON ¶
func RespondJSON(w http.ResponseWriter, code int, payload interface{})
RespondJSON Make response with json formate.
func RespondJSONWithXTotalCount ¶
func RespondJSONWithXTotalCount(w http.ResponseWriter, code int, count int, payload interface{})
RespondJSONWithXTotalCount Make response with json format and add X-Total-Count header.
func SetNewHeader ¶
func SetNewHeader(w http.ResponseWriter, headerName, value string)
SetNewHeader will expose and set the given headerName and value
SetNewHeader(w,"total","10") will set header "total" : "10"
func UnmarshalJSON ¶
UnmarshalJSON parses data from request and return otherwise error return.
Types ¶
type Parser ¶
Parser helps in parsing the data from the URL params.
func (*Parser) GetTenantID ¶
GetTenantID will get "tenantID" param in URL params.
func (*Parser) ParseLimitAndOffset ¶
ParseLimitAndOffset will parse limit and offset from query params.
Click to show internal directories.
Click to hide internal directories.