campus

package
v0.9.8 Latest Latest
Warning

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

Go to latest
Published: May 18, 2025 License: GPL-3.0 Imports: 6 Imported by: 0

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

Constants

This section is empty.

Variables

View Source
var (
	ErrNoAcademicYearFound   = errors.New("no academic year found")
	ErrNoTeachingPeriodFound = errors.New("no teaching period found")
	ErrNoWeekFound           = errors.New("no week found")
)

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

func (c *Campuser) GetAcademicYear(ctx context.Context, t time.Time) (AcademicYear, error)

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

func (c *Campuser) GetCurrentWeek(ctx context.Context) (Week, error)

GetCurrentWeek returns the week of the current time

func (*Campuser) GetTeachingPeriod added in v0.8.0

func (c *Campuser) GetTeachingPeriod(ctx context.Context, t time.Time) (TeachingPeriod, error)

GetTeachingPeriod retrieves an academic term for a given time

func (*Campuser) GetWeek

func (c *Campuser) GetWeek(ctx context.Context, t time.Time) (Week, error)

GetWeek retrieves the week and it's term

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

func NewCampuser(db *sqlx.DB) Repo

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

Jump to

Keyboard shortcuts

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