parkrun

package
v0.0.0-...-5e02cbe Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// DateFormat is the format used on the future roster web pages.
	DateFormat = "2 January 2006"
)

Variables

This section is empty.

Functions

func FutureRosterURL

func FutureRosterURL(basePrURL string) string

func LastEventNumber

func LastEventNumber(prBaseURL string) (int64, error)

func StartTestServer

func StartTestServer() *httptest.Server

Types

type EventDetails

type EventDetails struct {
	Date           time.Time
	RoleVolunteers []RoleVolunteer
}

EventDetails gives a run date and a list of the volunteers for that run.

func (EventDetails) String

func (details EventDetails) String() string

func (EventDetails) VolunteersForRole

func (details EventDetails) VolunteersForRole(role string) []string

VolunteersForRole returns the volunteer(s) for the provided role name.

type EventRunners

type EventRunners struct {
	Runners []Runner
	// contains filtered or unexported fields
}

func GetRunners

func GetRunners(prBaseURL string, eventNum int32) (*EventRunners, error)

type FutureRoster

type FutureRoster struct {
	SortedEvents []EventDetails
}

FutureRoster is a list of events scraped from a future roster web page.

func FetchFutureRoster

func FetchFutureRoster(basePrURL string) (FutureRoster, error)

FetchFutureRoster gets the volunteer rosters from the provided URL.

func (FutureRoster) FirstEventAfter

func (fr FutureRoster) FirstEventAfter(t time.Time) (EventDetails, error)

FirstEventAfter finds the first event in the roster after the provided time.

type RoleVolunteer

type RoleVolunteer struct {
	Role      string
	Volunteer string
}

RoleVolunteer is a pair of a role and a volunteer. The Volunteer may be empty if no volunteer is yet assigned.

type Runner

type Runner struct {
	Name      string
	AthleteID int64
	TotalRuns int
}

func GetUpcomingMilestones

func GetUpcomingMilestones(prBaseURL string, maxPastEvents int, timeBetweenGets time.Duration) []Runner

Jump to

Keyboard shortcuts

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