Documentation ¶
Index ¶
- Variables
- func Columns(src interface{}, includePk bool) ([]string, error)
- func Delete(db DB, table string, id int64) error
- func DeleteStatement(table string, id int64) (string, []interface{})
- func Insert(db DB, table string, src interface{}) (int64, error)
- func InsertStatement(table string, src interface{}) (string, []interface{}, error)
- func Update(db DB, table string, id int64, src interface{}) error
- func UpdateStatement(table string, id int64, src interface{}) (string, []interface{}, error)
- type CourseStore
- func (s *CourseStore) Create(p *model.Course) (*model.Course, error)
- func (s *CourseStore) Delete(courseID int64) error
- func (s *CourseStore) Disenroll(courseID int64, userID int64) error
- func (s *CourseStore) Enroll(courseID int64, userID int64, role int64) error
- func (s *CourseStore) EnrolledUsers(courseID int64, roleFilter []string, filterFirstName string, ...) ([]model.UserCourse, error)
- func (s *CourseStore) FindEnrolledUsers(courseID int64, roleFilter []string, filterQuery string) ([]model.UserCourse, error)
- func (s *CourseStore) Get(courseID int64) (*model.Course, error)
- func (s *CourseStore) GetAll() ([]model.Course, error)
- func (s *CourseStore) GetUserEnrollment(courseID int64, userID int64) (*model.UserCourse, error)
- func (s *CourseStore) PointsForUser(userID int64, courseID int64) ([]model.SheetPoints, error)
- func (s *CourseStore) RoleInCourse(userID int64, courseID int64) (authorize.CourseRole, error)
- func (s *CourseStore) Update(p *model.Course) error
- func (s *CourseStore) UpdateRole(courseID, userID int64, role int) error
- type DB
- type DatabaseSyntax
- func (d *DatabaseSyntax) Columns(src interface{}, includePk bool) ([]string, error)
- func (d *DatabaseSyntax) Delete(db DB, table string, id int64) error
- func (d *DatabaseSyntax) DeleteStatement(table string, id int64) (string, []interface{})
- func (d *DatabaseSyntax) Insert(db DB, table string, src interface{}) (int64, error)
- func (d *DatabaseSyntax) InsertStatement(table string, src interface{}) (string, []interface{}, error)
- func (d *DatabaseSyntax) PackStatementData(src interface{}) ([]StatementData, error)
- func (d *DatabaseSyntax) Update(db DB, table string, id int64, src interface{}) error
- func (d *DatabaseSyntax) UpdateStatement(table string, id int64, src interface{}) (string, []interface{}, error)
- type GradeStore
- func (s *GradeStore) Create(p *model.Grade) (*model.Grade, error)
- func (s *GradeStore) Get(id int64) (*model.Grade, error)
- func (s *GradeStore) GetAllMissingGrades(courseID int64, tutorID int64, groupID int64) ([]model.MissingGrade, error)
- func (s *GradeStore) GetFiltered(courseID int64, sheetID int64, taskID int64, groupID int64, userID int64, ...) ([]model.Grade, error)
- func (s *GradeStore) GetForSubmission(id int64) (*model.Grade, error)
- func (s *GradeStore) GetOverviewGrades(courseID int64, groupID int64) ([]model.OverviewGrade, error)
- func (s *GradeStore) IdentifyCourseOfGrade(gradeID int64) (*model.Course, error)
- func (s *GradeStore) IdentifyTaskOfGrade(gradeID int64) (*model.Task, error)
- func (s *GradeStore) Update(p *model.Grade) error
- func (s *GradeStore) UpdatePrivateTestInfo(gradeID int64, log string, status symbol.TestingResult) error
- func (s *GradeStore) UpdatePublicTestInfo(gradeID int64, log string, status symbol.TestingResult) error
- type GroupStore
- func (s *GroupStore) ChangeGroupEnrollmentOfUserInCourse(p *model.GroupEnrollment) error
- func (s *GroupStore) Create(p *model.Group) (*model.Group, error)
- func (s *GroupStore) CreateGroupEnrollmentOfUserInCourse(p *model.GroupEnrollment) (*model.GroupEnrollment, error)
- func (s *GroupStore) Delete(taskID int64) error
- func (s *GroupStore) EnrolledUsers(courseID int64, groupID int64, roleFilter []string, filterFirstName string, ...) ([]model.UserCourse, error)
- func (s *GroupStore) Get(groupID int64) (*model.Group, error)
- func (s *GroupStore) GetAll() ([]model.Group, error)
- func (s *GroupStore) GetBidOfUserForGroup(userID int64, groupID int64) (bid int, err error)
- func (s *GroupStore) GetBidsForCourse(courseID int64) ([]model.GroupBid, error)
- func (s *GroupStore) GetBidsForCourseForUser(courseID int64, userID int64) ([]model.GroupBid, error)
- func (s *GroupStore) GetGroupEnrollmentOfUserInCourse(userID int64, courseID int64) (*model.GroupEnrollment, error)
- func (s *GroupStore) GetInCourseWithUser(userID int64, courseID int64) ([]model.GroupWithTutor, error)
- func (s *GroupStore) GetMembers(groupID int64) ([]model.User, error)
- func (s *GroupStore) GetOfTutor(tutorID int64, courseID int64) ([]model.GroupWithTutor, error)
- func (s *GroupStore) GroupsOfCourse(courseID int64) ([]model.GroupWithTutor, error)
- func (s *GroupStore) IdentifyCourseOfGroup(groupID int64) (*model.Course, error)
- func (s *GroupStore) InsertBidOfUserForGroup(userID int64, groupID int64, bid int) (int, error)
- func (s *GroupStore) Update(p *model.Group) error
- func (s *GroupStore) UpdateBidOfUserForGroup(userID int64, groupID int64, bid int) (int, error)
- type MaterialStore
- func (s *MaterialStore) Create(p *model.Material, courseID int64) (*model.Material, error)
- func (s *MaterialStore) Delete(sheetID int64) error
- func (s *MaterialStore) Get(sheetID int64) (*model.Material, error)
- func (s *MaterialStore) GetAll() ([]model.Material, error)
- func (s *MaterialStore) IdentifyCourseOfMaterial(sheetID int64) (*model.Course, error)
- func (s *MaterialStore) MaterialsOfCourse(courseID int64, requiredRole int) ([]model.Material, error)
- func (s *MaterialStore) Update(p *model.Material) error
- type SheetStore
- func (s *SheetStore) Create(p *model.Sheet, courseID int64) (*model.Sheet, error)
- func (s *SheetStore) Delete(sheetID int64) error
- func (s *SheetStore) Get(sheetID int64) (*model.Sheet, error)
- func (s *SheetStore) GetAll() ([]model.Sheet, error)
- func (s *SheetStore) IdentifyCourseOfSheet(sheetID int64) (*model.Course, error)
- func (s *SheetStore) PointsForUser(userID int64, sheetID int64) ([]model.TaskPoints, error)
- func (s *SheetStore) SheetsOfCourse(courseID int64) ([]model.Sheet, error)
- func (s *SheetStore) Update(p *model.Sheet) error
- type StatementData
- type SubmissionStore
- func (s *SubmissionStore) Create(p *model.Submission) (*model.Submission, error)
- func (s *SubmissionStore) Get(submissionID int64) (*model.Submission, error)
- func (s *SubmissionStore) GetByUserAndTask(userID int64, taskID int64) (*model.Submission, error)
- func (s *SubmissionStore) GetFiltered(filterCourseID, filterGroupID, filterUserID, filterSheetID, filterTaskID int64) ([]model.Submission, error)
- type TaskStore
- func (s *TaskStore) Create(p *model.Task, sheetID int64) (*model.Task, error)
- func (s *TaskStore) CreateRating(p *model.TaskRating) (*model.TaskRating, error)
- func (s *TaskStore) Delete(taskID int64) error
- func (s *TaskStore) Get(taskID int64) (*model.Task, error)
- func (s *TaskStore) GetAll() ([]model.Task, error)
- func (s *TaskStore) GetAllMissingTasksForUser(userID int64) ([]model.MissingTask, error)
- func (s *TaskStore) GetAverageRating(taskID int64) (float32, error)
- func (s *TaskStore) GetRating(taskRatingID int64) (*model.TaskRating, error)
- func (s *TaskStore) GetRatingOfTaskByUser(taskID int64, userID int64) (*model.TaskRating, error)
- func (s *TaskStore) IdentifyCourseOfTask(taskID int64) (*model.Course, error)
- func (s *TaskStore) IdentifySheetOfTask(taskID int64) (*model.Sheet, error)
- func (s *TaskStore) TasksOfSheet(sheetID int64) ([]model.Task, error)
- func (s *TaskStore) Update(p *model.Task) error
- func (s *TaskStore) UpdateRating(p *model.TaskRating) error
- type UserStore
- func (s *UserStore) Create(p *model.User) (*model.User, error)
- func (s *UserStore) Delete(userID int64) error
- func (s *UserStore) Find(query string) ([]model.User, error)
- func (s *UserStore) FindByEmail(email string) (*model.User, error)
- func (s *UserStore) Get(userID int64) (*model.User, error)
- func (s *UserStore) GetAll() ([]model.User, error)
- func (s *UserStore) GetEnrollments(userID int64) ([]model.Enrollment, error)
- func (s *UserStore) Update(p *model.User) error
Constants ¶
This section is empty.
Variables ¶
var DefaultSyntax = PostgreSQLSyntax
var MySQLSyntax = &DatabaseSyntax{ Quote: "`", Placeholder: "?", UseReturningToGetID: false, }
MySQL contains database specific options for executing queries in a MySQL database
var PostgreSQLSyntax = &DatabaseSyntax{ Quote: `"`, Placeholder: "$1", UseReturningToGetID: true, }
PostgreSQL contains database specific options for executing queries in a PostgreSQL database
var ReflectCaching = true
var SQLiteSyntax = &DatabaseSyntax{ Quote: `"`, Placeholder: "?", UseReturningToGetID: false, }
SQLite contains database specific options for executing queries in a SQLite database
Functions ¶
func DeleteStatement ¶
func InsertStatement ¶
Types ¶
type CourseStore ¶
type CourseStore struct {
// contains filtered or unexported fields
}
func NewCourseStore ¶
func NewCourseStore(db *sqlx.DB) *CourseStore
func (*CourseStore) Delete ¶
func (s *CourseStore) Delete(courseID int64) error
func (*CourseStore) Enroll ¶
func (s *CourseStore) Enroll(courseID int64, userID int64, role int64) error
func (*CourseStore) EnrolledUsers ¶
func (*CourseStore) FindEnrolledUsers ¶
func (s *CourseStore) FindEnrolledUsers( courseID int64, roleFilter []string, filterQuery string, ) ([]model.UserCourse, error)
func (*CourseStore) GetUserEnrollment ¶
func (s *CourseStore) GetUserEnrollment(courseID int64, userID int64) (*model.UserCourse, error)
func (*CourseStore) PointsForUser ¶
func (s *CourseStore) PointsForUser(userID int64, courseID int64) ([]model.SheetPoints, error)
PointsForUser returns all gather points in a given course for a given user accumulated.
func (*CourseStore) RoleInCourse ¶
func (s *CourseStore) RoleInCourse(userID int64, courseID int64) (authorize.CourseRole, error)
func (*CourseStore) UpdateRole ¶
func (s *CourseStore) UpdateRole(courseID, userID int64, role int) error
type DatabaseSyntax ¶
type DatabaseSyntax struct { Quote string // the quote character for table and column names Placeholder string // the placeholder style to use in generated queries UseReturningToGetID bool // use PostgreSQL-style RETURNING "ID" instead of calling sql.Result.LastInsertID }
DatabaseSyntax contains driver specific settings.
func (*DatabaseSyntax) Columns ¶
func (d *DatabaseSyntax) Columns(src interface{}, includePk bool) ([]string, error)
Columns returns a list of column names for its input struct.
func (*DatabaseSyntax) Delete ¶
func (d *DatabaseSyntax) Delete(db DB, table string, id int64) error
func (*DatabaseSyntax) DeleteStatement ¶
func (d *DatabaseSyntax) DeleteStatement(table string, id int64) (string, []interface{})
func (*DatabaseSyntax) Insert ¶
func (d *DatabaseSyntax) Insert(db DB, table string, src interface{}) (int64, error)
func (*DatabaseSyntax) InsertStatement ¶
func (d *DatabaseSyntax) InsertStatement(table string, src interface{}) (string, []interface{}, error)
Build an sql statement to insert values returns the statement and values stmt, values, err := BuildInsertStatement(...) var newPk int64 err := db.QueryRow(stmt, values...).Scan(&newPk)
func (*DatabaseSyntax) PackStatementData ¶
func (d *DatabaseSyntax) PackStatementData(src interface{}) ([]StatementData, error)
PackStatementData reads a struct and extract necessary data for a query. This skips the primary key "id" automatically. No data modification is made.
func (*DatabaseSyntax) Update ¶
func (d *DatabaseSyntax) Update(db DB, table string, id int64, src interface{}) error
func (*DatabaseSyntax) UpdateStatement ¶
func (d *DatabaseSyntax) UpdateStatement(table string, id int64, src interface{}) (string, []interface{}, error)
Build an sql statement to update values returns the statement and values stmt, values, err := BuildInsertStatement(...) var newPk int64 err := db.QueryRow(stmt, values...).Scan(&newPk)
type GradeStore ¶
type GradeStore struct {
// contains filtered or unexported fields
}
func NewGradeStore ¶
func NewGradeStore(db *sqlx.DB) *GradeStore
func (*GradeStore) GetAllMissingGrades ¶
func (s *GradeStore) GetAllMissingGrades(courseID int64, tutorID int64, groupID int64) ([]model.MissingGrade, error)
func (*GradeStore) GetFiltered ¶
func (*GradeStore) GetForSubmission ¶
func (s *GradeStore) GetForSubmission(id int64) (*model.Grade, error)
func (*GradeStore) GetOverviewGrades ¶
func (s *GradeStore) GetOverviewGrades(courseID int64, groupID int64) ([]model.OverviewGrade, error)
func (*GradeStore) IdentifyCourseOfGrade ¶
func (s *GradeStore) IdentifyCourseOfGrade(gradeID int64) (*model.Course, error)
func (*GradeStore) IdentifyTaskOfGrade ¶
func (s *GradeStore) IdentifyTaskOfGrade(gradeID int64) (*model.Task, error)
func (*GradeStore) UpdatePrivateTestInfo ¶
func (s *GradeStore) UpdatePrivateTestInfo(gradeID int64, log string, status symbol.TestingResult) error
func (*GradeStore) UpdatePublicTestInfo ¶
func (s *GradeStore) UpdatePublicTestInfo(gradeID int64, log string, status symbol.TestingResult) error
type GroupStore ¶
type GroupStore struct {
// contains filtered or unexported fields
}
func NewGroupStore ¶
func NewGroupStore(db *sqlx.DB) *GroupStore
func (*GroupStore) ChangeGroupEnrollmentOfUserInCourse ¶
func (s *GroupStore) ChangeGroupEnrollmentOfUserInCourse(p *model.GroupEnrollment) error
func (*GroupStore) CreateGroupEnrollmentOfUserInCourse ¶
func (s *GroupStore) CreateGroupEnrollmentOfUserInCourse(p *model.GroupEnrollment) (*model.GroupEnrollment, error)
func (*GroupStore) Delete ¶
func (s *GroupStore) Delete(taskID int64) error
func (*GroupStore) EnrolledUsers ¶
func (*GroupStore) GetBidOfUserForGroup ¶
func (s *GroupStore) GetBidOfUserForGroup(userID int64, groupID int64) (bid int, err error)
func (*GroupStore) GetBidsForCourse ¶
func (s *GroupStore) GetBidsForCourse(courseID int64) ([]model.GroupBid, error)
func (*GroupStore) GetBidsForCourseForUser ¶
func (*GroupStore) GetGroupEnrollmentOfUserInCourse ¶
func (s *GroupStore) GetGroupEnrollmentOfUserInCourse(userID int64, courseID int64) (*model.GroupEnrollment, error)
func (*GroupStore) GetInCourseWithUser ¶
func (s *GroupStore) GetInCourseWithUser(userID int64, courseID int64) ([]model.GroupWithTutor, error)
func (*GroupStore) GetMembers ¶
func (s *GroupStore) GetMembers(groupID int64) ([]model.User, error)
func (*GroupStore) GetOfTutor ¶
func (s *GroupStore) GetOfTutor(tutorID int64, courseID int64) ([]model.GroupWithTutor, error)
func (*GroupStore) GroupsOfCourse ¶
func (s *GroupStore) GroupsOfCourse(courseID int64) ([]model.GroupWithTutor, error)
func (*GroupStore) IdentifyCourseOfGroup ¶
func (s *GroupStore) IdentifyCourseOfGroup(groupID int64) (*model.Course, error)
func (*GroupStore) InsertBidOfUserForGroup ¶
func (*GroupStore) UpdateBidOfUserForGroup ¶
type MaterialStore ¶
type MaterialStore struct {
// contains filtered or unexported fields
}
func NewMaterialStore ¶
func NewMaterialStore(db *sqlx.DB) *MaterialStore
func (*MaterialStore) Delete ¶
func (s *MaterialStore) Delete(sheetID int64) error
func (*MaterialStore) IdentifyCourseOfMaterial ¶
func (s *MaterialStore) IdentifyCourseOfMaterial(sheetID int64) (*model.Course, error)
func (*MaterialStore) MaterialsOfCourse ¶
type SheetStore ¶
type SheetStore struct {
// contains filtered or unexported fields
}
func NewSheetStore ¶
func NewSheetStore(db *sqlx.DB) *SheetStore
func (*SheetStore) Delete ¶
func (s *SheetStore) Delete(sheetID int64) error
func (*SheetStore) IdentifyCourseOfSheet ¶
func (s *SheetStore) IdentifyCourseOfSheet(sheetID int64) (*model.Course, error)
func (*SheetStore) PointsForUser ¶
func (s *SheetStore) PointsForUser(userID int64, sheetID int64) ([]model.TaskPoints, error)
PointsForUser returns all gather points in a given sheet for a given user accumulated.
func (*SheetStore) SheetsOfCourse ¶
func (s *SheetStore) SheetsOfCourse(courseID int64) ([]model.Sheet, error)
type StatementData ¶
type StatementData struct { Column string Value interface{} }
func PackStatementData ¶
func PackStatementData(src interface{}) ([]StatementData, error)
type SubmissionStore ¶
type SubmissionStore struct {
// contains filtered or unexported fields
}
func NewSubmissionStore ¶
func NewSubmissionStore(db *sqlx.DB) *SubmissionStore
func (*SubmissionStore) Create ¶
func (s *SubmissionStore) Create(p *model.Submission) (*model.Submission, error)
func (*SubmissionStore) Get ¶
func (s *SubmissionStore) Get(submissionID int64) (*model.Submission, error)
func (*SubmissionStore) GetByUserAndTask ¶
func (s *SubmissionStore) GetByUserAndTask(userID int64, taskID int64) (*model.Submission, error)
func (*SubmissionStore) GetFiltered ¶
func (s *SubmissionStore) GetFiltered(filterCourseID, filterGroupID, filterUserID, filterSheetID, filterTaskID int64) ([]model.Submission, error)
type TaskStore ¶
type TaskStore struct {
// contains filtered or unexported fields
}
func NewTaskStore ¶
func (*TaskStore) CreateRating ¶
func (s *TaskStore) CreateRating(p *model.TaskRating) (*model.TaskRating, error)
func (*TaskStore) GetAllMissingTasksForUser ¶
func (s *TaskStore) GetAllMissingTasksForUser(userID int64) ([]model.MissingTask, error)
func (*TaskStore) GetAverageRating ¶
func (*TaskStore) GetRating ¶
func (s *TaskStore) GetRating(taskRatingID int64) (*model.TaskRating, error)
func (*TaskStore) GetRatingOfTaskByUser ¶
func (*TaskStore) IdentifyCourseOfTask ¶
func (*TaskStore) IdentifySheetOfTask ¶
func (*TaskStore) TasksOfSheet ¶
func (*TaskStore) UpdateRating ¶
func (s *TaskStore) UpdateRating(p *model.TaskRating) error
type UserStore ¶
type UserStore struct {
// contains filtered or unexported fields
}
func NewUserStore ¶
func (*UserStore) GetEnrollments ¶
func (s *UserStore) GetEnrollments(userID int64) ([]model.Enrollment, error)