types

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Day

type Day struct {
	WeekNumber int       `json:"week_number"`
	Lessons    [8]Lesson `json:"lessons"`
}

Day represents the school day (the row in the schedule table) that contains eight Lessons.

type Duration

type Duration int

Duration represents the lesson's duration.

func (Duration) String

func (d Duration) String() string

type IncorrectDateError

type IncorrectDateError struct {
	Date string
}

IncorrectDateError is returned when the date does not match the "dd.mm" format or does not exist.

func (*IncorrectDateError) Error

func (e *IncorrectDateError) Error() string

type IncorrectLinkError added in v0.9.2

type IncorrectLinkError struct {
	Name        string
	NameFromURL string
}

IncorrectLinkError is returned when when the schedule on the link does not match the expected schedule.

func (*IncorrectLinkError) Error added in v0.9.2

func (e *IncorrectLinkError) Error() string

type IncorrectWeekNumberError

type IncorrectWeekNumberError struct {
	WeekNum int
}

IncorrectWeekNumberError is returned when the value of the school week number is out of the acceptable range.

func (*IncorrectWeekNumberError) Error

func (e *IncorrectWeekNumberError) Error() string

type Lesson

type Lesson struct {
	SubLessons []SubLesson `json:"sub_lessons"`
}

Lesson represents the lesson (the cell in the schedule table) that can contain one or more SubLessons.

func (Lesson) GetGroupsTeacherLesson

func (l Lesson) GetGroupsTeacherLesson() string

func (Lesson) StringGroupLesson

func (l Lesson) StringGroupLesson() string

StringGroupLesson returns a string representation of Lesson based on the structure of the lesson display for groups.

func (Lesson) StringRoomLesson added in v1.0.4

func (l Lesson) StringRoomLesson() string

StringRoomLesson returns a string representation of Lesson based on the structure of the lesson display for rooms.

func (Lesson) StringTeacherLesson

func (l Lesson) StringTeacherLesson() string

type LessonType

type LessonType int

LessonType is the type of the lesson. Can take 3 values: Lecture, Laboratory and Practice.

const (
	Lecture LessonType = iota
	Laboratory
	Practice
	Unknown
)

func (LessonType) String

func (lt LessonType) String() string

type Schedule

type Schedule struct {
	Weeks [2]Week `json:"weeks"`
}

Schedule represents the full schedule that contains two school Weeks.

func (Schedule) MarshalEasyJSON

func (v Schedule) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (*Schedule) UnmarshalEasyJSON

func (v *Schedule) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

type ScheduleType added in v1.0.4

type ScheduleType int

ScheduleType is the type of the schedule

const (
	Group ScheduleType = iota
	Teacher
)

type StatusCodeError

type StatusCodeError struct {
	StatusCode int
	StatusText string
}

StatusCodeError is returned when a http.Get returns a response with a status code other than 200.

func (*StatusCodeError) Error

func (e *StatusCodeError) Error() string

type SubLesson

type SubLesson struct {
	Duration Duration   `json:"с"`
	Type     LessonType `json:"type"`
	Group    string     `json:"group"`
	Name     string     `json:"name"`
	Teacher  string     `json:"teacher"`
	Room     string     `json:"room"`
	Practice string     `json:"practice"`
	SubGroup string     `json:"sub_group"`
}

SubLesson represents the nested lesson. During the time of one lesson, a group or teacher can have several SubLessons at the same time.

func (SubLesson) StringGroup added in v1.0.4

func (sl SubLesson) StringGroup() string

StringGroup returns a string representation of SubLesson based on the structure of the lesson display for groups.

func (SubLesson) StringGroupSubLesson

func (sl SubLesson) StringGroupSubLesson() string

StringGroupSubLesson returns a string representation of SubLesson based on the structure of the lesson display for groups.

func (SubLesson) StringRoomSubLesson added in v1.0.4

func (sl SubLesson) StringRoomSubLesson() string

StringRoomSubLesson returns a string representation of SubLesson based on the structure of the lesson display for rooms.

type UnavailableScheduleError added in v0.9.1

type UnavailableScheduleError struct {
	Name       string // teacher or group name
	WeekNum    int    // equals -1 if the full schedule is requested
	WeekDayNum int    // equals -1 if the week schedule is requested
}

UnavailableScheduleError is returned when the week schedule is missing or not published.

func (*UnavailableScheduleError) Error added in v0.9.1

func (e *UnavailableScheduleError) Error() string

type Week

type Week struct {
	Number    int       `json:"number"`
	DateStart time.Time `json:"date_start"`
	DateEnd   time.Time `json:"date_end"`
	Days      [7]Day    `json:"days"`
}

Week represents the school week (one of two schedule tables) that contains seventh Days.

Jump to

Keyboard shortcuts

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