Documentation ¶
Index ¶
- Variables
- type Date
- func (d Date) Add(duration time.Duration) Date
- func (d Date) After(other Date) bool
- func (d Date) AsTime(clock time.Time) time.Time
- func (d Date) Before(other Date) bool
- func (d Date) Eq(other Date) bool
- func (d Date) MarshalJSON() ([]byte, error)
- func (d Date) String() string
- func (d *Date) UnmarshalJSON(b []byte) error
- type MassShootingRecord
- type MassShootingsScraper
- type Scraper
Constants ¶
This section is empty.
Variables ¶
var TZ = func() *time.Location { l, err := time.LoadLocation("America/New_York") if err != nil { log.Panicln("cannot load location America/New_York:", err) } return l }()
TZ is Eastern Time.
Functions ¶
This section is empty.
Types ¶
type Date ¶
type Date struct {
// contains filtered or unexported fields
}
Date is a date type with no time.
func (Date) Add ¶
Add returns d + duration. If duration is less than 24h (1d), then it does nothing.
func (Date) AsTime ¶
AsTime converts the date into a Time using the clock within the time. The given clock time's timezone is used for the returned time.
func (Date) MarshalJSON ¶
func (*Date) UnmarshalJSON ¶
type MassShootingRecord ¶
type MassShootingRecord struct { IncidentID int IncidentDate Date State string CityCounty string Address string NoKilled int NoInjured int IncidentURL string SourceURL string }
MassShootingRecord is a single record within a mass shootings record table.
func MassShootingsOnDate ¶
func MassShootingsOnDate(ctx context.Context, scraper MassShootingsScraper, date Date) ([]MassShootingRecord, error)
MassShootingsOnDate fetches the list of all mass shooting records within the given day by automatically paginating the getter.
type MassShootingsScraper ¶
type MassShootingsScraper interface {
MassShootings(ctx context.Context, i int) ([]MassShootingRecord, error)
}
MassShootingsScraper describes Scraper's MassShootings getter.
type Scraper ¶
func (*Scraper) MassShootings ¶
MassShootings scrapes for the list of mass shootings.
func (*Scraper) MassShootingsOnDate ¶
MassShootingsOnDate returns a list of mass shooting records for the given date.
func (*Scraper) MassShootingsToday ¶
func (s *Scraper) MassShootingsToday(ctx context.Context) ([]MassShootingRecord, error)
MassShootingsToday returns a list of mass shooting records for today.