Versions in this module Expand all Collapse all v0 v0.10.0 May 7, 2021 Changes in this version + func RespondWithDispatchTypeError(w http.ResponseWriter, got interface{}) + type Meta struct + Code int + Error string + Message string + type Response struct + Data interface{} + Meta *Meta + Pagination *Page v0.9.13 Oct 12, 2020 v0.9.12 Sep 10, 2020 Changes in this version + var DefaultMaxPageSize = 100 + var DefaultPageSize = 50 + var OrderASC = "asc" + var OrderDESC = "desc" + 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(r *http.Request, key string, def bool) bool + func ReqParamInt(r *http.Request, key string, def int) int + func RespondWithError(w http.ResponseWriter, err 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 APIError struct + Code int + Message string + func NewAPIError(code int, message string) *APIError + func (err *APIError) Error() string + type Order struct + Direction string + Key string + func NewOrder(key, orderDirection string) Order + func (o Order) String() string + type OrderBy []Order + func NewOrderByFromString(orderBy string, validKeys []string) OrderBy + func OrderByFromRequest(r *http.Request) OrderBy + func OrderByFromRequestWithKeys(r *http.Request, validKeys []string) OrderBy + func (o OrderBy) SetQueryParams(u *url.URL) *url.URL + func (o OrderBy) String() string + type Page struct + NextURL string + Number int + PrevURL string + ResultCount int + Size int + func NewPage(number, size int) Page + func NewPageFromOffsetAndLimit(offset, limit int) Page + func PageFromRequest(r *http.Request) Page + func (p Page) Limit() int + func (p Page) Next() Page + func (p Page) NextPageExists() bool + func (p Page) Offset() int + func (p Page) Prev() Page + func (p Page) PrevPageExists() bool + func (p Page) SetQueryParams(u *url.URL) *url.URL