ucm

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2021 License: Apache-2.0 Imports: 14 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetClientTimeout added in v0.0.4

func SetClientTimeout(tm time.Duration)

SetClientTimeout sets the client timeout

func SetHTTPClient added in v0.0.4

func SetHTTPClient(c http.Client)

SetHTTPClient lets callers set the package level http client

func SubjectsOffered added in v0.0.4

func SubjectsOffered(config ScheduleConfig) (map[string]string, error)

SubjectsOffered will pull down the courses offered for a semester

Types

type Course

type Course struct {
	CRN int
	// comprised of the subject code and course number
	Fullcode string

	// Course subject code
	Subject string
	// course number
	Number int
	// Lab or Discussion section. If the object is
	// a lecture then this should be 01
	Section string

	// Course title
	Title string

	Exam     *Exam
	Units    int
	Activity string // TODO this should be changed to "Type CourseType"
	Days     []time.Weekday
	Time     struct {
		Start, End time.Time
	}

	BuildingRoom string
	Date         struct {
		Start, End time.Time
	}
	Instructor string

	Capacity int
	Enrolled int
	// contains filtered or unexported fields
}

Course holds data for a specific course that has been parsed from the courses table.

func (*Course) CourseNumber

func (c *Course) CourseNumber() int

CourseNumber returns the number used to semantically identify the course

func (*Course) ID

func (c *Course) ID() int

ID returns the course's crn

func (*Course) Info added in v0.0.4

func (c *Course) Info() (string, error)

Info get extra info for the course

func (*Course) Name

func (c *Course) Name() string

Name returns the courses title

func (*Course) SeatsOpen

func (c *Course) SeatsOpen() int

SeatsOpen gets the number of seats available for the course.

type CourseType added in v0.0.4

type CourseType string

CourseType is a label for the type of course i.e. lecture, lab, discussion, etc.

const (
	Lecture    CourseType = "LECT"
	Lab        CourseType = "LAB"
	Discussion CourseType = "DISC"
	Seminar    CourseType = "SEM"
	Studio     CourseType = "STDO"
	FiedWork   CourseType = "FLDW"
	Initiative CourseType = "INI" // TODO still not sure what this means, sticking with initiative for now

)

These are the only course types

type Exam added in v0.0.4

type Exam struct {
	Day      time.Weekday
	Building string
	Date     time.Time
	Time     struct {
		Start, End time.Time
	}
}

Exam is a course exam

type Schedule

type Schedule map[int]*Course

Schedule is a map of courses by course CRN

func BySubject

func BySubject(year int, term, subject string, open bool) (Schedule, error)

BySubject gets the schedule and only one subject given a subject code.

func Get

func Get(year int, term string, open bool) (Schedule, error)

Get gets the schedule

func NewSchedule

func NewSchedule(config ScheduleConfig) (Schedule, error)

NewSchedule will return a new schedule based on the config.

func (*Schedule) Courses

func (s *Schedule) Courses() []school.Course

Courses returns a list of courses as a course interface.

func (*Schedule) Get

func (s *Schedule) Get(id int) school.Course

Get will get a course given the course id

func (*Schedule) Len added in v0.0.4

func (s *Schedule) Len() int

Len returns the number of courses in the schedule

func (*Schedule) Ordered

func (s *Schedule) Ordered() []*Course

Ordered will return a slice of courses that preserves the original order.

type ScheduleConfig

type ScheduleConfig struct {
	Year    int
	Term    string
	Subject string
	Open    bool
}

ScheduleConfig holds options for getting the UC Merced schedule

Jump to

Keyboard shortcuts

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