Documentation ¶
Index ¶
- type DataAge
- type RequestTimings
- type Response
- func (r *Response) AddDataAge(times ...time.Time)
- func (rp *Response) End(w http.ResponseWriter, r *http.Request)
- func (r *Response) GetDataAgeMax() (t time.Time)
- func (r *Response) GetDataAgeMin() (t time.Time)
- func (rp *Response) Start(w http.ResponseWriter, r *http.Request)
- func (r *Response) TimerDuration() time.Duration
- func (r *Response) TimerEnd()
- func (r *Response) TimerStart()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RequestTimings ¶
type Response ¶
type Response struct { Timer *RequestTimings `json:"request_timings,omitempty"` DataAge *DataAge `json:"data_age"` StatusCode int `json:"status"` Errors []error `json:"errors"` Metadata map[string]interface{} `json:"metadata"` Result []map[string]interface{} `json:"result"` }
func (*Response) AddDataAge ¶
AddDataAge is used to track the created times of the data associated with this api response. This provides a way to show messages about when the data was created / updated in front ends
func (*Response) GetDataAgeMax ¶
GetDataAgeMax returns the max date stored within the data in this api response (effectively the "youngest")
func (*Response) GetDataAgeMin ¶
GetDataAgeMin returns the min date stored within the data in this api response (effectively the "oldest")
func (*Response) TimerDuration ¶
TimerDuration uses the end & start times to work out how long a http request has taken to be processed. This informaton is helpful for assessing performance over the api
func (*Response) TimerEnd ¶
func (r *Response) TimerEnd()
TimerEnd is companiion to TimerStart, this tracks the end of the http request being processed and can then be used to work out duration.
func (*Response) TimerStart ¶
func (r *Response) TimerStart()
TimerStart is called early in the http request handler to accurately track the start time of the request. This is then used with end time to work out durations that can be checked for performance etc