mit

package
v0.0.0-...-8dc1090 Latest Latest
Warning

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

Go to latest
Published: May 10, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrBadTermCode = errors.New("mit: unknown term code")

ErrBadTermCode is reported when the given term code doesn't exist.

Functions

This section is empty.

Types

type ScheduledMeeting

type ScheduledMeeting struct {
	Weekdays     []time.Weekday
	StartSeconds int
	EndSeconds   int
}

A ScheduledMeeting struct contains details about a scheduled meeting in a TimeInfo. Each TimeInfo can have multiple ScheduledMeetings.

func ParseScheduledMeeting

func ParseScheduledMeeting(scheduledMeetingString string, termInfo TermInfo) (*ScheduledMeeting, *time.Time, *time.Time, error)

ParseScheduledMeeting parses the given time info string, in a format like "MW4-5.30"

type TermInfo

type TermInfo struct {
	Code              string
	FirstDayOfClasses time.Time
	LastDayOfClasses  time.Time
	ExceptionDays     map[string]time.Weekday
}

A TermInfo struct contains information about an academic term.

func GetCurrentTerm

func GetCurrentTerm() TermInfo

GetCurrentTerm returns a TermInfo struct for the current academic term.

func GetTermByCode

func GetTermByCode(code string) (TermInfo, error)

GetTermByCode returns the TermInfo struct for the term with the given code, or ErrBadTermCode if the term couldn't be found.

type TimeInfo

type TimeInfo struct {
	Meetings []ScheduledMeeting
	BeginsOn time.Time
	EndsOn   time.Time
}

A TimeInfo struct contains details about when a class's section meets.

func ParseTimeInfo

func ParseTimeInfo(timeInfoString string, termInfo TermInfo) (TimeInfo, error)

ParseTimeInfo parses out the time information from an input string in the format "MW9-11,F9".

Jump to

Keyboard shortcuts

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