Documentation
¶
Overview ¶
Package campus, this is a collection of useful endpoints relating to what campus will hopefully offer: current term, are you on a campus net, are you on the ystv net
Index ¶
- Variables
- type AcademicYear
- type Campuser
- func (c *Campuser) GetAcademicYear(ctx context.Context, t time.Time) (AcademicYear, error)
- func (c *Campuser) GetCurrentAcademicYear(ctx context.Context) (AcademicYear, error)
- func (c *Campuser) GetCurrentTeachingPeriod(ctx context.Context) (TeachingPeriod, error)
- func (c *Campuser) GetCurrentWeek(ctx context.Context) (Week, error)
- func (c *Campuser) GetTeachingPeriod(ctx context.Context, t time.Time) (TeachingPeriod, error)
- func (c *Campuser) GetWeek(ctx context.Context, t time.Time) (Week, error)
- type Repo
- type TeachingPeriod
- type Week
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type AcademicYear ¶ added in v0.8.0
type AcademicYear struct {
Year int `db:"year" json:"year"`
TeachingCycle []TeachingPeriod `json:"teachingCycle"`
}
AcademicYear represents the academic year and the teaching cycle
type Campuser ¶
type Campuser struct {
// contains filtered or unexported fields
}
func (*Campuser) GetAcademicYear ¶ added in v0.8.0
GetAcademicYear retrieves an academic year for a given time
func (*Campuser) GetCurrentAcademicYear ¶ added in v0.8.0
func (c *Campuser) GetCurrentAcademicYear(ctx context.Context) (AcademicYear, error)
GetCurrentAcademicYear returns the academic year as of the current time
func (*Campuser) GetCurrentTeachingPeriod ¶ added in v0.8.0
func (c *Campuser) GetCurrentTeachingPeriod(ctx context.Context) (TeachingPeriod, error)
GetCurrentTeachingPeriod returns the teaching period as of the current time
func (*Campuser) GetCurrentWeek ¶
GetCurrentWeek returns the week of the current time
func (*Campuser) GetTeachingPeriod ¶ added in v0.8.0
GetTeachingPeriod retrieves an academic term for a given time
type Repo ¶ added in v0.9.6
type Repo interface {
GetAcademicYear(ctx context.Context, t time.Time) (AcademicYear, error)
GetTeachingPeriod(ctx context.Context, t time.Time) (TeachingPeriod, error)
GetWeek(ctx context.Context, t time.Time) (Week, error)
GetCurrentAcademicYear(ctx context.Context) (AcademicYear, error)
GetCurrentTeachingPeriod(ctx context.Context) (TeachingPeriod, error)
GetCurrentWeek(ctx context.Context) (Week, error)
}
func NewCampuser ¶ added in v0.9.6
type TeachingPeriod ¶ added in v0.8.0
type TeachingPeriod struct {
TeachingPeriodID int `db:"teaching_period_id" json:"teachingPeriodID"`
Year int `db:"year" json:"year"`
Name string `db:"name" json:"name"` // autumn / spring / summer
Start time.Time `db:"start" json:"start"`
Finish time.Time `db:"finish" json:"finish"`
}
TeachingPeriod represents an academic time period either a term or semester
type Week ¶
type Week struct {
TeachingPeriod TeachingPeriod `json:"teachingPeriod"`
WeekNo int `json:"weekNo"`
}
Week is a normal week plus the number since the start of a teaching period