sqlite

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2024 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

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

func New(url string, ctx context.Context) (db *DB, err error)

New initializes a new database connection and sets up the necessary tables if they don't exist.

func (*DB) AddCourse

func (db *DB) AddCourse(course *itpgDB.Course) (err error)

AddCourse adds a new course to the database.

func (*DB) AddCourseMany

func (db *DB) AddCourseMany(courses []*itpgDB.Course) (err error)

AddCourseMany adds new courses to the database.

func (*DB) AddCourseProfessor added in v0.3.2

func (db *DB) AddCourseProfessor(professorUUID, courseCode string) (err error)

AddCourseProfessor adds a course to a professor in the database.

func (*DB) AddCourseProfessorMany added in v0.3.2

func (db *DB) AddCourseProfessorMany(professorUUIDS, courseCodes []string) (err error)

AddCourseProfessorMany adds courses to professors in the database.

func (*DB) AddProfessor

func (db *DB) AddProfessor(name string) (err error)

AddProfessor adds a new professor to the database.

func (*DB) AddProfessorMany

func (db *DB) AddProfessorMany(names []string) (err error)

AddProfessorMany adds new professors to the database.

func (*DB) Close

func (db *DB) Close() error

Close closes the database connection.

func (*DB) GetCoursesByProfessorUUID

func (db *DB) GetCoursesByProfessorUUID(UUID string) (courses []*itpgDB.Course, err error)

GetCoursesByProfessor retrieves all courses associated with a professor from the database.

func (*DB) GetLastCourses

func (db *DB) GetLastCourses() (courses []*itpgDB.Course, err error)

GetLastCourses retrieves the last 100 courses from the database.

func (*DB) GetLastProfessors

func (db *DB) GetLastProfessors() (professors []*itpgDB.Professor, err error)

GetLastProfessors retrieves the last 100 professors from the database.

func (*DB) GetLastScores

func (db *DB) GetLastScores() (scores []*itpgDB.Score, err error)

GetLastScores retrieves the last 100 scores from the database.

func (*DB) GetProfessorUUIDByName

func (db *DB) GetProfessorUUIDByName(name string) (uuid string, err error)

GetProfessorUUIDByName retrieves the UUID of the professor that matches the specified name.

func (*DB) GetProfessorsByCourseCode

func (db *DB) GetProfessorsByCourseCode(code string) (professors []*itpgDB.Professor, err error)

GetProfessorsByCourse retrieves all professors associated with a course from the database.

func (*DB) GetScoresByCourseCode

func (db *DB) GetScoresByCourseCode(code string) (scores []*itpgDB.Score, err error)

GetScoresByCourseCode retrieves all scores associated with a course from the database.

func (*DB) GetScoresByCourseCodeLike

func (db *DB) GetScoresByCourseCodeLike(codeLike string) (scores []*itpgDB.Score, err error)

GetScoresByCourseCodeLike retrieves the last 100 scores associated with a course code from the database that matches the given search string

func (*DB) GetScoresByCourseName

func (db *DB) GetScoresByCourseName(name string) (scores []*itpgDB.Score, err error)

GetScoresByCourseName retrieves all scores associated with a course from the database.

func (*DB) GetScoresByCourseNameLike

func (db *DB) GetScoresByCourseNameLike(nameLike string) (scores []*itpgDB.Score, err error)

GetScoresByCourseNameLike retrieves the last 100 scores associated with a course code from the database that matches the given search string

func (*DB) GetScoresByProfessorName

func (db *DB) GetScoresByProfessorName(name string) (scores []*itpgDB.Score, err error)

GetScoresByProfessorName retrieves all scores associated with a professor's name from the database.

func (*DB) GetScoresByProfessorNameLike

func (db *DB) GetScoresByProfessorNameLike(nameLike string) (scores []*itpgDB.Score, err error)

GetScoresByProfessorNameLike retrieves the last 100 scores for courses taught by professors whose names contain the given search string.

func (*DB) GetScoresByProfessorUUID

func (db *DB) GetScoresByProfessorUUID(UUID string) (scores []*itpgDB.Score, err error)

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

func (db *DB) RemoveCourse(code string, forceDelete bool) (err error)

RemoveCourse removes a course from the database. If forceDelete is true, associated scores are also deleted.

func (*DB) RemoveProfessor

func (db *DB) RemoveProfessor(professorUUID string, forceDelete bool) (err error)

RemoveProfessor removes a professor from the database. If forceDelete is true, associated scores are also deleted.

Jump to

Keyboard shortcuts

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