Documentation
¶
Index ¶
- Constants
- type Attendance
- type AttendanceList
- type BackendDatabase
- func (item *BackendDatabase) AllAttendanceListInRange(start time.Time, end time.Time) ([]AttendanceList, error)
- func (item *BackendDatabase) AllAttendanceListInRangeByCourse(course Course, start time.Time, end time.Time) ([]AttendanceList, error)
- func (item *BackendDatabase) ConnectDatabase() error
- func (item *BackendDatabase) CourseByName(name string) (Course, error)
- func (item *BackendDatabase) CourseStudents(course Course) ([]Student, error)
- func (item *BackendDatabase) Courses() ([]Course, error)
- func (item *BackendDatabase) InsertCourse(course Course) (Course, error)
- func (item *BackendDatabase) InsertList(list AttendanceList) (AttendanceList, error)
- func (item *BackendDatabase) InsertStudent(student Student) (Student, error)
- func (item *BackendDatabase) LatestList(course Course, end time.Time) (AttendanceList, error)
- func (item *BackendDatabase) Settings() ([]Setting, error)
- func (item *BackendDatabase) SettingsReset() ([]Setting, error)
- func (item *BackendDatabase) SettingsUpdate(settings []Setting) ([]Setting, error)
- func (item *BackendDatabase) Students(student Student) ([]Student, error)
- func (item *BackendDatabase) UpdateList(list AttendanceList) (AttendanceList, error)
- type Course
- type Rectangle
- type Setting
- type Student
Constants ¶
const DEFAULT_ORDER = "ReceivedAt DESC"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Attendance ¶
type AttendanceList ¶
type AttendanceList struct { ID uint `gorm:"primaryKey"` // CreatedAt is a primary key to ensure, that only one list per day can exist CreatedAt time.Time `gorm:"primaryKey"` UpdatedAt time.Time CourseID uint //`gorm:"foreignKey:Id;references:Course"` ReceivedAt time.Time Attendancies []Attendance Image []byte // image as png }
type BackendDatabase ¶
func NewBackend ¶
func NewBackend(mvvm mvvm, path string) *BackendDatabase
func (*BackendDatabase) AllAttendanceListInRange ¶
func (item *BackendDatabase) AllAttendanceListInRange(start time.Time, end time.Time) ([]AttendanceList, error)
Get all attendance lists for aall courses in a time range.
[start, end)
func (*BackendDatabase) AllAttendanceListInRangeByCourse ¶
func (item *BackendDatabase) AllAttendanceListInRangeByCourse(course Course, start time.Time, end time.Time) ([]AttendanceList, error)
Get all attendance lists for a course in a time range.
[start, end)
func (*BackendDatabase) ConnectDatabase ¶
func (item *BackendDatabase) ConnectDatabase() error
Ensure that the database is present and all tables being there
func (*BackendDatabase) CourseByName ¶
func (item *BackendDatabase) CourseByName(name string) (Course, error)
Get a course by name.
func (*BackendDatabase) CourseStudents ¶
func (item *BackendDatabase) CourseStudents(course Course) ([]Student, error)
Get all students in a `course`.
func (*BackendDatabase) Courses ¶
func (item *BackendDatabase) Courses() ([]Course, error)
Get all courses saved in the database.
func (*BackendDatabase) InsertCourse ¶
func (item *BackendDatabase) InsertCourse(course Course) (Course, error)
Insert a new course. It is not checked whether the course already exists.
func (*BackendDatabase) InsertList ¶
func (item *BackendDatabase) InsertList(list AttendanceList) (AttendanceList, error)
This function allows only one list per day. If a list already exists, it overwrites it. AttendanceList must be filled out fully, except the ID.
func (*BackendDatabase) InsertStudent ¶
func (item *BackendDatabase) InsertStudent(student Student) (Student, error)
Add a new student to the database. student.FullName will be set automatically.
func (*BackendDatabase) LatestList ¶
func (item *BackendDatabase) LatestList(course Course, end time.Time) (AttendanceList, error)
Get the latest list before a certain date for a course [..., end)
func (*BackendDatabase) Settings ¶
func (item *BackendDatabase) Settings() ([]Setting, error)
Get all settings saved in the database
func (*BackendDatabase) SettingsReset ¶
func (item *BackendDatabase) SettingsReset() ([]Setting, error)
Reset all settings. This clears the `Setting` table
func (*BackendDatabase) SettingsUpdate ¶
func (item *BackendDatabase) SettingsUpdate(settings []Setting) ([]Setting, error)
Update settings. `settings` need not contain all key-value pairs.
func (*BackendDatabase) Students ¶
func (item *BackendDatabase) Students(student Student) ([]Student, error)
func (*BackendDatabase) UpdateList ¶
func (item *BackendDatabase) UpdateList(list AttendanceList) (AttendanceList, error)
`list` needs the field `Id` to be not null.
type Student ¶
type Student struct { gorm.Model FirstName string `gorm:"check:FirstName!='';type:varchar(64)"` LastName string `gorm:"check:LastName!='';type:varchar(64)"` FullName string `gorm:"check:FullName!='';type:varchar(128);uniqueIndex:namecourseunique;index;not null"` CourseID uint `gorm:"uniqueIndex:namecourseunique;not null"` IsImmatriculated bool `gorm:"default:true"` }