Documentation ¶
Index ¶
- Constants
- func EmptyOkHandler(w http.ResponseWriter, r *http.Request)
- func HealthCheckHandler(w http.ResponseWriter, r *http.Request)
- func NotFoundHandler(w http.ResponseWriter, r *http.Request)
- func ReqParamBool(key string, r *http.Request) (bool, error)
- func ReqParamInt(key string, r *http.Request) (int, error)
- func WriteErrResponse(w http.ResponseWriter, code int, err error) error
- func WriteMessageResponse(w http.ResponseWriter, message string, data interface{}) error
- func WritePageResponse(w http.ResponseWriter, data interface{}, r *http.Request, p Page) error
- func WriteResponse(w http.ResponseWriter, data interface{}) error
- type Page
Constants ¶
View Source
const DEFAULT_PAGE_SIZE = 100
Variables ¶
This section is empty.
Functions ¶
func EmptyOkHandler ¶
func EmptyOkHandler(w http.ResponseWriter, r *http.Request)
EmptyOkHandler is an empty 200 response, often used for OPTIONS requests that responds with headers set in addCorsHeaders
func HealthCheckHandler ¶
func HealthCheckHandler(w http.ResponseWriter, r *http.Request)
HealthCheckHandler is a basic "hey I'm fine" for load balancers & co TODO - add Database connection & proper configuration checks here for more accurate health reporting
func NotFoundHandler ¶
func NotFoundHandler(w http.ResponseWriter, r *http.Request)
func ReqParamBool ¶
TODO - consider providing a default param & removing the error
func ReqParamInt ¶
TODO - consider providing a default param & removing the error
func WriteErrResponse ¶
func WriteErrResponse(w http.ResponseWriter, code int, err error) error
func WriteMessageResponse ¶
func WriteMessageResponse(w http.ResponseWriter, message string, data interface{}) error
func WritePageResponse ¶
func WriteResponse ¶
func WriteResponse(w http.ResponseWriter, data interface{}) error
Types ¶
type Page ¶
a page represents pagination data & common pagination
func NewPageFromOffsetAndLimit ¶
NewPageFromOffsetAndLimit converts a offset and Limit to a Page struct
func PageFromRequest ¶
pull pagination params from an http request
Click to show internal directories.
Click to hide internal directories.