https://github.com/nf1s/go-covid
Go package for gathering data regarding the novel corona virus from John Hopkins University
https://github.com/nf1s/go-covid
coronavirus coronavirus-info covid covid-19 go golang
Last synced: 19 days ago
JSON representation
Go package for gathering data regarding the novel corona virus from John Hopkins University
- Host: GitHub
- URL: https://github.com/nf1s/go-covid
- Owner: nf1s
- License: mit
- Archived: true
- Created: 2020-03-12T19:41:04.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2020-09-21T18:03:03.000Z (over 4 years ago)
- Last Synced: 2025-03-06T23:23:38.283Z (about 2 months ago)
- Topics: coronavirus, coronavirus-info, covid, covid-19, go, golang
- Language: Go
- Homepage: https://ahmednafies.github.io/go-covid/
- Size: 818 KB
- Stars: 7
- Watchers: 2
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# go-covid
[](https://circleci.com/gh/ahmednafies/go-covid) [](https://codecov.io/gh/ahmednafies/go-covid)
## Description
Go Package to get information regarding the novel corona virus provided by Johns Hopkins university
Full Documentation can be found [here](https://ahmednafies.github.io/go-covid/)
## How to install
```go
go get -u github.com/ahmednafies/go-covid/covid
```## How to use
### Get All Data
```go
data, err := covid.GetData()
if err != nil {
// Handle error here
}
fmt.Println(data)
```### Get Status By Country Name
```go
data, err := covid.GetCountryByName("italy")
if err != nil {
// Handle error here
}fmt.Println(data.Attrs.Id)
fmt.Println(data.Attrs.Country)
fmt.Println(data.Attrs.LastUpdate)
fmt.Println(data.Attrs.Confirmed)
fmt.Println(data.Attrs.Deaths)
fmt.Println(data.Attrs.Active)
fmt.Println(data.Attrs.Recovered)
fmt.Println(data.Attrs.Latitude)
fmt.Println(data.Attrs.Longitude)
```#### Result
```go
113
Italy
1584216796000
21157
1441
17750
1966
41.8719
```### List Countries
```go
list, err := covid.ListCountries()
if err != nil {
// Handle error here
}
```#### Result
```go
[
Attrs{
Id: 40
Name: Hungary
},
Attrs{
Id: 113
Name: Italy
}
...
]
```### Get Status by Country ID
```go
data, err := covid.GetCountryById(113)
```### Get Total Active Cases
```go
active, err := covid.GetTotalActive()
```### Get Total Confirmed Cases
```go
confirmed, err := covid.GetTotalConfirmed()
```### Get Total Recovered Cases
```go
recovered, err := covid.GetTotalRecovered()
```### Get Total Deaths
```go
deaths, err := covid.GetTotalDeaths()
```