Documentation ¶
Index ¶
- Constants
- type APICasesResponse
- type APICasesResponseEntry
- func (v *APICasesResponseEntry) GetGroupFieldValue(groupField int) (value string)
- func (v *APICasesResponseEntry) GetTimestamp() time.Time
- func (v APICasesResponseEntry) MarshalEasyJSON(w *jwriter.Writer)
- func (v APICasesResponseEntry) MarshalJSON() ([]byte, error)
- func (v *APICasesResponseEntry) UnmarshalEasyJSON(l *jlexer.Lexer)
- func (v *APICasesResponseEntry) UnmarshalJSON(data []byte) error
- type APIHospitalisationsResponse
- type APIHospitalisationsResponseEntry
- func (v *APIHospitalisationsResponseEntry) GetGroupFieldValue(groupField int) (value string)
- func (v *APIHospitalisationsResponseEntry) GetTimestamp() time.Time
- func (v APIHospitalisationsResponseEntry) MarshalEasyJSON(w *jwriter.Writer)
- func (v APIHospitalisationsResponseEntry) MarshalJSON() ([]byte, error)
- func (v *APIHospitalisationsResponseEntry) UnmarshalEasyJSON(l *jlexer.Lexer)
- func (v *APIHospitalisationsResponseEntry) UnmarshalJSON(data []byte) error
- type APIMortalityResponse
- type APIMortalityResponseEntry
- func (v *APIMortalityResponseEntry) GetGroupFieldValue(groupField int) (value string)
- func (v *APIMortalityResponseEntry) GetTimestamp() time.Time
- func (v APIMortalityResponseEntry) MarshalEasyJSON(w *jwriter.Writer)
- func (v APIMortalityResponseEntry) MarshalJSON() ([]byte, error)
- func (v *APIMortalityResponseEntry) UnmarshalEasyJSON(l *jlexer.Lexer)
- func (v *APIMortalityResponseEntry) UnmarshalJSON(data []byte) error
- type APITestResultsResponse
- type APITestResultsResponseEntry
- func (v *APITestResultsResponseEntry) GetGroupFieldValue(groupField int) (value string)
- func (v *APITestResultsResponseEntry) GetTimestamp() time.Time
- func (v APITestResultsResponseEntry) MarshalEasyJSON(w *jwriter.Writer)
- func (v APITestResultsResponseEntry) MarshalJSON() ([]byte, error)
- func (v *APITestResultsResponseEntry) UnmarshalEasyJSON(l *jlexer.Lexer)
- func (v *APITestResultsResponseEntry) UnmarshalJSON(data []byte) error
- type APIVaccinationsResponse
- type APIVaccinationsResponseEntry
- func (v *APIVaccinationsResponseEntry) GetGroupFieldValue(groupField int) (value string)
- func (v *APIVaccinationsResponseEntry) GetTimestamp() time.Time
- func (v APIVaccinationsResponseEntry) MarshalEasyJSON(w *jwriter.Writer)
- func (v APIVaccinationsResponseEntry) MarshalJSON() ([]byte, error)
- func (v *APIVaccinationsResponseEntry) UnmarshalEasyJSON(l *jlexer.Lexer)
- func (v *APIVaccinationsResponseEntry) UnmarshalJSON(data []byte) error
- type Cache
- func (cache *Cache) AutoRefresh(ctx context.Context)
- func (cache *Cache) CacheSize() int
- func (cache *Cache) GetCases(ctx context.Context) (results []Measurement, err error)
- func (cache *Cache) GetHospitalisations(ctx context.Context) (results []Measurement, err error)
- func (cache *Cache) GetMortality(ctx context.Context) (results []Measurement, err error)
- func (cache *Cache) GetTestResults(ctx context.Context) (results []Measurement, err error)
- func (cache *Cache) GetVaccinations(ctx context.Context) (results []Measurement, err error)
- type Client
- func (client *Client) GetCases(ctx context.Context) (results []Measurement, err error)
- func (client *Client) GetHospitalisations(ctx context.Context) (results []Measurement, err error)
- func (client *Client) GetMortality(ctx context.Context) (results []Measurement, err error)
- func (client *Client) GetTestResults(ctx context.Context) (results []Measurement, err error)
- func (client *Client) GetVaccinations(ctx context.Context) (results []Measurement, err error)
- type Getter
- type Measurement
- type TimeStamp
Constants ¶
const ( // GroupByNone is used by GetGroupFieldValue. This groups all data regardless of age, region, province, etc. GroupByNone int = iota // GroupByAgeGroup is used by GetGroupFieldValue. This groups all data by Age Group. GroupByAgeGroup // GroupByRegion is used by GetGroupFieldValue. This groups all data by Region GroupByRegion // GroupByProvince is used by GetGroupFieldValue. This groups all data by Province GroupByProvince )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APICasesResponse ¶ added in v1.6.0
type APICasesResponse []*APICasesResponseEntry
APICasesResponse is the response of the Sciensano cases API
func (APICasesResponse) MarshalEasyJSON ¶ added in v1.7.0
func (v APICasesResponse) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (APICasesResponse) MarshalJSON ¶ added in v1.7.0
func (v APICasesResponse) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*APICasesResponse) UnmarshalEasyJSON ¶ added in v1.7.0
func (v *APICasesResponse) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*APICasesResponse) UnmarshalJSON ¶ added in v1.7.0
func (v *APICasesResponse) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type APICasesResponseEntry ¶ added in v1.7.0
type APICasesResponseEntry struct { TimeStamp TimeStamp `json:"DATE"` Province string `json:"PROVINCE"` Region string `json:"REGION"` AgeGroup string `json:"AGEGROUP"` Cases int `json:"CASES"` }
APICasesResponseEntry is a single entry in APICasesResponse
func (*APICasesResponseEntry) GetGroupFieldValue ¶ added in v1.7.0
func (v *APICasesResponseEntry) GetGroupFieldValue(groupField int) (value string)
GetGroupFieldValue returns the value of the specified entry's field
func (*APICasesResponseEntry) GetTimestamp ¶ added in v1.7.0
func (v *APICasesResponseEntry) GetTimestamp() time.Time
GetTimestamp returns the entry's timestamp
func (APICasesResponseEntry) MarshalEasyJSON ¶ added in v1.7.0
func (v APICasesResponseEntry) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (APICasesResponseEntry) MarshalJSON ¶ added in v1.7.0
func (v APICasesResponseEntry) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*APICasesResponseEntry) UnmarshalEasyJSON ¶ added in v1.7.0
func (v *APICasesResponseEntry) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*APICasesResponseEntry) UnmarshalJSON ¶ added in v1.7.0
func (v *APICasesResponseEntry) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type APIHospitalisationsResponse ¶ added in v1.7.0
type APIHospitalisationsResponse []*APIHospitalisationsResponseEntry
APIHospitalisationsResponse is the response of the Sciensano cases API
func (APIHospitalisationsResponse) MarshalEasyJSON ¶ added in v1.7.0
func (v APIHospitalisationsResponse) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (APIHospitalisationsResponse) MarshalJSON ¶ added in v1.7.0
func (v APIHospitalisationsResponse) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*APIHospitalisationsResponse) UnmarshalEasyJSON ¶ added in v1.7.0
func (v *APIHospitalisationsResponse) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*APIHospitalisationsResponse) UnmarshalJSON ¶ added in v1.7.0
func (v *APIHospitalisationsResponse) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type APIHospitalisationsResponseEntry ¶ added in v1.7.0
type APIHospitalisationsResponseEntry struct { TimeStamp TimeStamp `json:"DATE"` Province string `json:"PROVINCE"` Region string `json:"REGION"` TotalIn int `json:"TOTAL_IN"` TotalInICU int `json:"TOTAL_IN_ICU"` TotalInResp int `json:"TOTAL_IN_RESP"` TotalInECMO int `json:"TOTAL_IN_ECMO"` }
APIHospitalisationsResponseEntry is a single entry in APIHospitalisationsResponse
func (*APIHospitalisationsResponseEntry) GetGroupFieldValue ¶ added in v1.7.0
func (v *APIHospitalisationsResponseEntry) GetGroupFieldValue(groupField int) (value string)
GetGroupFieldValue returns the value of the specified entry's field
func (*APIHospitalisationsResponseEntry) GetTimestamp ¶ added in v1.7.0
func (v *APIHospitalisationsResponseEntry) GetTimestamp() time.Time
GetTimestamp returns the entry's timestamp
func (APIHospitalisationsResponseEntry) MarshalEasyJSON ¶ added in v1.7.0
func (v APIHospitalisationsResponseEntry) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (APIHospitalisationsResponseEntry) MarshalJSON ¶ added in v1.7.0
func (v APIHospitalisationsResponseEntry) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*APIHospitalisationsResponseEntry) UnmarshalEasyJSON ¶ added in v1.7.0
func (v *APIHospitalisationsResponseEntry) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*APIHospitalisationsResponseEntry) UnmarshalJSON ¶ added in v1.7.0
func (v *APIHospitalisationsResponseEntry) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type APIMortalityResponse ¶ added in v1.7.0
type APIMortalityResponse []*APIMortalityResponseEntry
APIMortalityResponse is the response of the Sciensano cases API
func (APIMortalityResponse) MarshalEasyJSON ¶ added in v1.7.0
func (v APIMortalityResponse) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (APIMortalityResponse) MarshalJSON ¶ added in v1.7.0
func (v APIMortalityResponse) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*APIMortalityResponse) UnmarshalEasyJSON ¶ added in v1.7.0
func (v *APIMortalityResponse) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*APIMortalityResponse) UnmarshalJSON ¶ added in v1.7.0
func (v *APIMortalityResponse) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type APIMortalityResponseEntry ¶ added in v1.7.0
type APIMortalityResponseEntry struct { TimeStamp TimeStamp `json:"DATE"` Region string `json:"REGION"` AgeGroup string `json:"AGEGROUP"` Deaths int `json:"DEATHS"` }
APIMortalityResponseEntry is a single entry in APIMortalityResponse
func (*APIMortalityResponseEntry) GetGroupFieldValue ¶ added in v1.7.0
func (v *APIMortalityResponseEntry) GetGroupFieldValue(groupField int) (value string)
GetGroupFieldValue returns the value of the specified entry's field
func (*APIMortalityResponseEntry) GetTimestamp ¶ added in v1.7.0
func (v *APIMortalityResponseEntry) GetTimestamp() time.Time
GetTimestamp returns the entry's timestamp
func (APIMortalityResponseEntry) MarshalEasyJSON ¶ added in v1.7.0
func (v APIMortalityResponseEntry) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (APIMortalityResponseEntry) MarshalJSON ¶ added in v1.7.0
func (v APIMortalityResponseEntry) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*APIMortalityResponseEntry) UnmarshalEasyJSON ¶ added in v1.7.0
func (v *APIMortalityResponseEntry) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*APIMortalityResponseEntry) UnmarshalJSON ¶ added in v1.7.0
func (v *APIMortalityResponseEntry) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type APITestResultsResponse ¶
type APITestResultsResponse []*APITestResultsResponseEntry
APITestResultsResponse is the response of the Sciensano test results API
func (APITestResultsResponse) MarshalEasyJSON ¶ added in v1.7.0
func (v APITestResultsResponse) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (APITestResultsResponse) MarshalJSON ¶ added in v1.7.0
func (v APITestResultsResponse) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*APITestResultsResponse) UnmarshalEasyJSON ¶ added in v1.7.0
func (v *APITestResultsResponse) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*APITestResultsResponse) UnmarshalJSON ¶ added in v1.7.0
func (v *APITestResultsResponse) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type APITestResultsResponseEntry ¶ added in v1.7.0
type APITestResultsResponseEntry struct { TimeStamp TimeStamp `json:"DATE"` Province string `json:"PROVINCE"` Region string `json:"REGION"` Total int `json:"TESTS_ALL"` Positive int `json:"TESTS_ALL_POS"` }
APITestResultsResponseEntry is a single entry in APITestResultsResponse
func (*APITestResultsResponseEntry) GetGroupFieldValue ¶ added in v1.7.0
func (v *APITestResultsResponseEntry) GetGroupFieldValue(groupField int) (value string)
GetGroupFieldValue returns the value of the specified entry's field
func (*APITestResultsResponseEntry) GetTimestamp ¶ added in v1.7.0
func (v *APITestResultsResponseEntry) GetTimestamp() time.Time
GetTimestamp returns the entry's timestamp
func (APITestResultsResponseEntry) MarshalEasyJSON ¶ added in v1.7.0
func (v APITestResultsResponseEntry) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (APITestResultsResponseEntry) MarshalJSON ¶ added in v1.7.0
func (v APITestResultsResponseEntry) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*APITestResultsResponseEntry) UnmarshalEasyJSON ¶ added in v1.7.0
func (v *APITestResultsResponseEntry) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*APITestResultsResponseEntry) UnmarshalJSON ¶ added in v1.7.0
func (v *APITestResultsResponseEntry) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type APIVaccinationsResponse ¶
type APIVaccinationsResponse []*APIVaccinationsResponseEntry
APIVaccinationsResponse is the response of the Sciensano vaccinations API
func (APIVaccinationsResponse) MarshalEasyJSON ¶ added in v1.7.0
func (v APIVaccinationsResponse) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (APIVaccinationsResponse) MarshalJSON ¶ added in v1.7.0
func (v APIVaccinationsResponse) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*APIVaccinationsResponse) UnmarshalEasyJSON ¶ added in v1.7.0
func (v *APIVaccinationsResponse) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*APIVaccinationsResponse) UnmarshalJSON ¶ added in v1.7.0
func (v *APIVaccinationsResponse) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type APIVaccinationsResponseEntry ¶ added in v1.7.0
type APIVaccinationsResponseEntry struct { TimeStamp TimeStamp `json:"DATE"` Region string `json:"REGION"` AgeGroup string `json:"AGEGROUP"` Gender string `json:"SEX"` Dose string `json:"DOSE"` Count int `json:"COUNT"` }
APIVaccinationsResponseEntry is a single entry in APIVaccinationResponse
func (*APIVaccinationsResponseEntry) GetGroupFieldValue ¶ added in v1.7.0
func (v *APIVaccinationsResponseEntry) GetGroupFieldValue(groupField int) (value string)
GetGroupFieldValue returns the value of the specified entry's field
func (*APIVaccinationsResponseEntry) GetTimestamp ¶ added in v1.7.0
func (v *APIVaccinationsResponseEntry) GetTimestamp() time.Time
GetTimestamp returns the entry's timestamp
func (APIVaccinationsResponseEntry) MarshalEasyJSON ¶ added in v1.7.0
func (v APIVaccinationsResponseEntry) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (APIVaccinationsResponseEntry) MarshalJSON ¶ added in v1.7.0
func (v APIVaccinationsResponseEntry) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*APIVaccinationsResponseEntry) UnmarshalEasyJSON ¶ added in v1.7.0
func (v *APIVaccinationsResponseEntry) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*APIVaccinationsResponseEntry) UnmarshalJSON ¶ added in v1.7.0
func (v *APIVaccinationsResponseEntry) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type Cache ¶
Cache implements a cache for the Sciensano API. It's meant to be API-compatible with Getter, so clients can replace their Getter with a Cache instead:
client := &Client{ Getter: &apiclient.Client{HTTPClient: &http.Client{}}, }
becomes:
client := &Client{ Getter: &apiclient.Cache{ Getter: &apiclient.Client{HTTPClient: &http.Client{}}, Retention: 15 * time.Minute, }, }
func (*Cache) AutoRefresh ¶ added in v1.7.0
AutoRefresh refreshes the cache on a period basis
func (*Cache) CacheSize ¶ added in v1.7.0
CacheSize returns the number of entries currently in the cache
func (*Cache) GetCases ¶ added in v1.6.0
func (cache *Cache) GetCases(ctx context.Context) (results []Measurement, err error)
GetCases retrieves all COVID-19 cases. If a valid cached result exists, that is returned instead.
func (*Cache) GetHospitalisations ¶ added in v1.7.0
func (cache *Cache) GetHospitalisations(ctx context.Context) (results []Measurement, err error)
GetHospitalisations retrieves all hospitalisations. If a valid cached result exists, that is returned instead.
func (*Cache) GetMortality ¶ added in v1.7.0
func (cache *Cache) GetMortality(ctx context.Context) (results []Measurement, err error)
GetMortality retrieves all COVID-19 deaths. If a valid cached result exists, that is returned instead.
func (*Cache) GetTestResults ¶
func (cache *Cache) GetTestResults(ctx context.Context) (results []Measurement, err error)
GetTestResults retrieves all COVID-19 test results. If a valid cached result exists, that is returned instead.
func (*Cache) GetVaccinations ¶
func (cache *Cache) GetVaccinations(ctx context.Context) (results []Measurement, err error)
GetVaccinations retrieves all COVID-19 vaccinations. If a valid cached result exists, that is returned instead.
type Client ¶
Client calls the different sciensano APIs
func (*Client) GetCases ¶ added in v1.6.0
func (client *Client) GetCases(ctx context.Context) (results []Measurement, err error)
GetCases retrieves all recorded COVID-19 cases
func (*Client) GetHospitalisations ¶ added in v1.7.0
func (client *Client) GetHospitalisations(ctx context.Context) (results []Measurement, err error)
GetHospitalisations retrieves all recorded COVID-19 cases
func (*Client) GetMortality ¶ added in v1.7.0
func (client *Client) GetMortality(ctx context.Context) (results []Measurement, err error)
GetMortality retrieves all recorded COVID-19 mortality figures
func (*Client) GetTestResults ¶
func (client *Client) GetTestResults(ctx context.Context) (results []Measurement, err error)
GetTestResults retrieves all COVID-19 test results.
func (*Client) GetVaccinations ¶
func (client *Client) GetVaccinations(ctx context.Context) (results []Measurement, err error)
GetVaccinations retrieves all COVID-19 vaccinations.
type Getter ¶ added in v1.6.0
type Getter interface { GetTestResults(ctx context.Context) (results []Measurement, err error) GetVaccinations(ctx context.Context) (results []Measurement, err error) GetCases(ctx context.Context) (results []Measurement, err error) GetMortality(ctx context.Context) (results []Measurement, err error) GetHospitalisations(ctx context.Context) (results []Measurement, err error) }
Getter interface exposes the different supported Sciensano APIs
type Measurement ¶ added in v1.7.0
Measurement represent a data measurement returned by one of the Sciensano APIs.