db

package
v0.0.0-...-834dd92 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2020 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddRate

func AddRate(date time.Time, staff uint64, city uint64, campus uint64) error

AddRate creates a new rate in the database.

func DeleteInRange

func DeleteInRange(from time.Time, to time.Time) error

DeleteInRange deletes all rate records that are within a provided time range.

func FetchInRange

func FetchInRange(from time.Time, to time.Time) (*[]Rate, error)

FetchInRange gets all rate records that are within a provided time range.

func Init

func Init() error

Init setups up a connection to the database if it exists. If not, it attempts to download a recent version from GitHub. If all else fails, it creates a new database. If that fails, the program exists.

func UpdateForDate

func UpdateForDate(date time.Time, staff uint64, city uint64, campus uint64) error

UpdateForDate updates a given record. Useful for not making crazy large ids.

Types

type Rate

type Rate struct {
	Date   time.Time `db:"date"`
	Campus uint64    `db:"campus"`
	City   uint64    `db:"city"`
	Staff  uint64    `db:"staff"`
}

Rate represents the covid cases for a single day.

func Earliest

func Earliest() (*Rate, error)

Earliest gets the first recent rate record found in the database.

func MostRecent

func MostRecent() (*Rate, error)

MostRecent gets the most recent rate record.

Jump to

Keyboard shortcuts

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