govid19

package module
v0.0.0-...-7aa59ad Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 7, 2020 License: MIT Imports: 7 Imported by: 0

README

govid19 - Worldometer COVID-19 scraper

GitHub go.mod Go version

govid19 is a very simple scraper of Worldometer COVID-19 developed with Go. This is my very first Go package. Since the start of the isolation, I've been quite bored so I decided to learn Go... sigh As you will see, the package is not very big because its main purpose was to learn how to structure a Go package

Usage

package main

import "github.com/gabrielmbmb/govid19"

func main() {
	countries := govid19.Scrape()
	err := govid19.WriteToCSV(countries)
	if err != nil {
		panic(err)
	}
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WriteToCSV

func WriteToCSV(countries []*Country) error

Types

type Country

type Country struct {
	Name            string `csv:"country_other"`
	TotalCases      int    `csv:"total_cases"`
	NewCases        int    `csv:"new_cases"`
	TotalDeaths     int    `csv:"total_deaths"`
	NewDeaths       int    `csv:"new_deaths"`
	TotalRecovered  int    `csv:"total_recovered"`
	ActiveCases     int    `csv:"active_cases"`
	SeriousCritical int    `csv:"seriousor_critical"`
	TotalCases1MPop int    `csv:"total_cases_1m_pop"`
	Deaths1MPop     int    `csv:"deaths_1m_pop"`
	TotalTests      int    `csv:"total_tests"`
	Tests1MPop      int    `csv:"tests_1m_pop"`
}

func Scrape

func Scrape() []*Country

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL