Documentation
¶
Index ¶
Constants ¶
View Source
const ( AllDataEndpoint = "https://coronavirus-19-api.herokuapp.com/all" AllCountriesEndpoint = "https://coronavirus-19-api.herokuapp.com/countries" CountryDataEndpoint = "https://coronavirus-19-api.herokuapp.com/countries/" )
The different endpoints of the API
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CountryData ¶
type CountryData struct { Country string `json:"country"` Cases int `json:"cases"` TodayCases int `json:"todayCases"` Deaths int `json:"deaths"` TodayDeaths int `json:"todayDeaths"` Recovered int `json:"recovered"` Active int `json:"active"` Critical int `json:"critical"` CasesPerOneMillion int `json:"casesPerOneMillion"` DeathsPerOneMillion int `json:"deathsPerOneMillion"` TotalTests int `json:"totalTests"` TestsPerOneMillion int `json:"testsPerOneMillion"` }
Stores covid data about any country
func GetAllCountriesData ¶
func GetAllCountriesData() ([]CountryData, error)
Gets a list which contains all the data about every available country Returns:
([]CountryData, error)
func GetCountriesDataByEndLimit ¶
func GetCountriesDataByEndLimit(endLimit int, startLimit int) ([]CountryData, error)
Similar to GetCountriesDataByLimit, but lets you specify a start and end limit for more control. Params:
endLimit int startLimit int
Returns:
([]CountryData, error)
func GetCountriesDataByLimit ¶
func GetCountriesDataByLimit(limit int) ([]CountryData, error)
The same as GetAllCountriesData, but allows you to explicitly specify a limit on many elements to get. Params:
limit int
Returns:
([]CountryData, error)
func GetCountryData ¶
func GetCountryData(country string) (*CountryData, error)
Gets data about a given country. Params:
country string
Returns:
(*CountryData, error)
type GlobalData ¶
type GlobalData struct { Cases int `json:"cases"` Deaths int `json:"deaths"` Recovered int `json:"recovered"` }
Stores global covid data
func GetGlobalData ¶
func GetGlobalData() (*GlobalData, error)
Gets data about the global cases, recoveries and deaths Returns:
(*GlobalData, error)
Click to show internal directories.
Click to hide internal directories.