Documentation ¶
Index ¶
- type DB
- func (db *DB) AddCourse(course *itpgDB.Course) (err error)
- func (db *DB) AddCourseMany(courses []*itpgDB.Course) (err error)
- func (db *DB) AddCourseProfessor(professorUUID, courseCode string) (err error)
- func (db *DB) AddCourseProfessorMany(professorUUIDS, courseCodes []string) (err error)
- func (db *DB) AddProfessor(name string) (err error)
- func (db *DB) AddProfessorMany(names []string) (err error)
- func (db *DB) Close() error
- func (db *DB) GetCoursesByProfessorUUID(UUID string) (courses []*itpgDB.Course, err error)
- func (db *DB) GetLastCourses() (courses []*itpgDB.Course, err error)
- func (db *DB) GetLastProfessors() (professors []*itpgDB.Professor, err error)
- func (db *DB) GetLastScores() (scores []*itpgDB.Score, err error)
- func (db *DB) GetProfessorUUIDByName(name string) (uuid string, err error)
- func (db *DB) GetProfessorsByCourseCode(code string) (professors []*itpgDB.Professor, err error)
- func (db *DB) GetScoresByCourseCode(code string) (scores []*itpgDB.Score, err error)
- func (db *DB) GetScoresByCourseCodeLike(codeLike string) (scores []*itpgDB.Score, err error)
- func (db *DB) GetScoresByCourseName(name string) (scores []*itpgDB.Score, err error)
- func (db *DB) GetScoresByCourseNameLike(nameLike string) (scores []*itpgDB.Score, err error)
- func (db *DB) GetScoresByProfessorName(name string) (scores []*itpgDB.Score, err error)
- func (db *DB) GetScoresByProfessorNameLike(nameLike string) (scores []*itpgDB.Score, err error)
- func (db *DB) GetScoresByProfessorUUID(UUID string) (scores []*itpgDB.Score, err error)
- func (db *DB) GradeCourseProfessor(professorUUID, courseCode, username string, grades [3]float32) (err error)
- func (db *DB) RemoveCourse(code string, forceDelete bool) (err error)
- func (db *DB) RemoveProfessor(professorUUID string, forceDelete bool) (err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB is a struct contaning a SQL database connection
func New ¶
New initializes a new database connection and sets up the necessary tables if they don't exist.
func (*DB) AddCourseMany ¶
AddCourseMany adds new courses to the database.
func (*DB) AddCourseProfessor ¶ added in v0.3.2
AddCourseProfessor adds a course to a professor in the database.
func (*DB) AddCourseProfessorMany ¶ added in v0.3.2
AddCourseProfessorMany adds courses to professors in the database.
func (*DB) AddProfessor ¶
AddProfessor adds a new professor to the database.
func (*DB) AddProfessorMany ¶
AddProfessorMany adds new professors to the database.
func (*DB) GetCoursesByProfessorUUID ¶
GetCoursesByProfessor retrieves all courses associated with a professor from the database.
func (*DB) GetLastCourses ¶
GetLastCourses retrieves the last 100 courses from the database.
func (*DB) GetLastProfessors ¶
GetLastProfessors retrieves the last 100 professors from the database.
func (*DB) GetLastScores ¶
GetLastScores retrieves the last 100 scores from the database.
func (*DB) GetProfessorUUIDByName ¶
GetProfessorUUIDByName retrieves the UUID of the professor that matches the specified name.
func (*DB) GetProfessorsByCourseCode ¶
GetProfessorsByCourse retrieves all professors associated with a course from the database.
func (*DB) GetScoresByCourseCode ¶
GetScoresByCourseCode retrieves all scores associated with a course from the database.
func (*DB) GetScoresByCourseCodeLike ¶
GetScoresByCourseCodeLike retrieves the last 100 scores associated with a course code from the database that matches the given search string
func (*DB) GetScoresByCourseName ¶
GetScoresByCourseName retrieves all scores associated with a course from the database.
func (*DB) GetScoresByCourseNameLike ¶
GetScoresByCourseNameLike retrieves the last 100 scores associated with a course code from the database that matches the given search string
func (*DB) GetScoresByProfessorName ¶
GetScoresByProfessorName retrieves all scores associated with a professor's name from the database.
func (*DB) GetScoresByProfessorNameLike ¶
GetScoresByProfessorNameLike retrieves the last 100 scores for courses taught by professors whose names contain the given search string.
func (*DB) GetScoresByProfessorUUID ¶
GetScoresByProfessorUUID retrieves all scores associated with a professor's UUID from the database.
func (*DB) GradeCourseProfessor ¶
func (db *DB) GradeCourseProfessor(professorUUID, courseCode, username string, grades [3]float32) (err error)
GradeCourseProfessor updates the scores of a professor for a specific course in the database.
func (*DB) RemoveCourse ¶
RemoveCourse removes a course from the database. If forceDelete is true, associated scores are also deleted.