File tree 1 file changed +38
-0
lines changed
1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change
1
+ /*
2
+ Package gocorna go-corona is a Golang client library for accessing global coronavirus (COVID-19, SARS-CoV-2) outbreak data.
3
+ It consumes data from Coronavirus Tracker API.
4
+
5
+ You can read the API server documentation at https://github.com/ExpDev07/coronavirus-tracker-api.
6
+
7
+ Usage:
8
+
9
+ create a new instance of Client, then use the various methods on the client to access different parts of the API.
10
+ For demonstration:
11
+ package main
12
+ import (
13
+ "context"
14
+ "fmt"
15
+ "log"
16
+
17
+ "github.com/itsksaurabh/go-corona"
18
+ )
19
+
20
+ func main() {
21
+ // client for accessing different endpoints of the API
22
+ client := gocorona.Client{}
23
+ ctx := context.Background()
24
+
25
+ // GetLatestData returns total amonut confirmed cases, deaths, and recoveries.
26
+ data, err := client.GetLatestData(ctx)
27
+ if err != nil {
28
+ log.Fatal("request failed:", err)
29
+ }
30
+ fmt.Println(data)
31
+ }
32
+
33
+ Notes:
34
+ * Using the [https://godoc.org/context](https://godoc.org/context) package for passing context.
35
+ * Look at tests(*_test.go) files for more sample usage.
36
+
37
+ */
38
+ package gocorona
You can’t perform that action at this time.
0 commit comments