Documentation
¶
Index ¶
Constants ¶
const BLOCKINTERVAL = 30
BLOCKINTERVAL the interval in minutes between each block.
const HOUR = 60
HOUR minutes whithin an hour.
const WEEKDAYS = 7
WEEKDAYS number of days in a week.
const WORKDAYS = 6
WORKDAYS number of days that can have lessons.
Variables ¶
var DaysEN = [...]string{"Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"}
DaysEN array with the name of the weekdays starting at monday (english).
var DaysPT = [...]string{"Seg", "Ter", "Qua", "Qui", "Sex", "Sab", "Dom"}
DaysPT array with the name of the weekdays starting at monday (portuguese).
Functions ¶
func DayIntToStr ¶
DayIntToStr returns the corresponding string to a numerical day (0 -> Seg, 1 -> Ter, etc.).
func DayStrToInt ¶
DayStrToInt returns the numerical representation of a weekday (Seg -> 0, Ter -> 1, etc.).
Types ¶
type CurricularUnit ¶
type CurricularUnit struct {
Name string `json:"name"`
Shifts map[string][]*Shift `json:"shifts"`
// contains filtered or unexported fields
}
CurricularUnit represents a Curricular Unit(CU).
func NewCU ¶
func NewCU(url string) *CurricularUnit
NewCU initializes a CU, returning its address. Utilizes goquery to scrape the CU page's relevant information.
func (*CurricularUnit) AddShift ¶
func (cu *CurricularUnit) AddShift(s *Shift)
AddShift adds a shift to the CU if it is not registered yet.
func (*CurricularUnit) String ¶
func (cu *CurricularUnit) String() string
String representation of a CU.
type Date ¶
type Date struct {
DayInt int `json:"day"`
Start *Hour `json:"start"`
End *Hour `json:"end"`
// contains filtered or unexported fields
}
Date represents a date. A Date has a weekday and a period of hours.
type Hour ¶
type Hour struct {
HourStr string `json:"time"`
// contains filtered or unexported fields
}
Hour represents an hour (HH:MM).
type Lesson ¶
type Lesson struct {
Date *Date `json:"date"`
// contains filtered or unexported fields
}
Lesson represents a lesson.
type Schedule ¶
type Schedule struct {
// contains filtered or unexported fields
}
Schedule represents a schedule. Has shifts and their respective lessons.
func NewSchedule ¶
func NewSchedule() *Schedule
NewSchedule initializes a schedule and returns its address.
type Shift ¶
type Shift struct {
Name string `json:"name"`
Type string `json:"type"`
Classes []string `json:"classes"`
Lessons []*Lesson `json:"lessons"`
// contains filtered or unexported fields
}
Shift represents a shift.
func NewShift ¶
func NewShift(cu *CurricularUnit, name string, sType string) *Shift
NewShift initializes a Shift and returns its adress.
func (*Shift) GetLessons ¶
GetLessons returns the lessons of the shift.