Documentation ¶
Overview ¶
Package database provides access to covid data sources from the web.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB is the database. The resources are lazy-loaded from 2 caches, either:
- in-memory, for the runtime;
- the file-system, as files saved in the specified directory.
If the cache period has expired, or the files don't exist already, the resources are taken from the web, and then stored in the caches.
func New ¶
New database. origin is the base URL common to all the resources (e.g. https://raw.githubusercontent.com/CSSEGISandData/COVID-1). cachedir is the full path of the directory where the resources are cached. cacheExpiration is the period after which the cache is refreshed (from endpoints under origin).
func (*DB) ActiveCases ¶
ActiveCases affected, selected by country and time.
func (*DB) Set ¶
func (db *DB) Set(n EndpointName, endpoint string)
Set a new named endpoint to a web resource. The first resource that is set is considered the one with all cases, while the next resources are the ones with cases that can be subtracted from first one's cases to give active cases (DB.ActiveCases).
type EndpointName ¶
type EndpointName string
EndpointName is a unique name identifying a web ednpoint and its related resource.
func (EndpointName) String ¶
func (e EndpointName) String() string