Documentation
¶
Index ¶
Constants ¶
View Source
const ( HeaderAccept = "Accept" HeaderContentType = "Content-Type" MediaTypeJson = "application/json" MediaTypeYaml = "application/x-yaml" ContentTypeYaml = MediaTypeYaml + "; charset=utf-8" ContentTypeJson = MediaTypeJson + "; charset=utf-8" )
Variables ¶
View Source
var ( DefaultMaxLimit = 300 DefaultMinLimit = 30 DefaultPageNumber = 1 )
Functions ¶
func NewRequestInterceptor ¶
creates a http.Handler that wraps the handler passed in and sets the original http protocol and host requested by the client
func SetProtocolAndHostIn ¶
set the (possibly forwarded) http protocol and host in the request
func WriteResponse ¶
func WriteResponse(w http.ResponseWriter, r *http.Request, v interface{})
Types ¶
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
func UriBuilder ¶
works out the request uri, including scheme, and port from the request passed in the full path is built up from this base
type Page ¶
type Page struct {
// defaults to 1, even if page does not contain any items
PageNumber int
// defaults to 30, max limit is 300
PerPage int
// it the page does not contain any items, this will be set to 0
TotalPages int
// (PageNumber - 1) * PerPage
StartIndex int
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.