repository

package
Version: v0.0.0-...-f2f702e Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2019 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 AssignmentRepository

type AssignmentRepository struct {
	// contains filtered or unexported fields
}

AssignmentRepository represents the layer between the database and the Assignment-model

func NewAssignmentRepository

func NewAssignmentRepository(db *sql.DB) *AssignmentRepository

NewAssignmentRepository returns a pointer to a new AssignmentRepository

func (*AssignmentRepository) Fetch

func (repo *AssignmentRepository) Fetch(id int) (*model.Assignment, error)

Fetch a single assignment from the database

func (*AssignmentRepository) FetchAll

func (repo *AssignmentRepository) FetchAll() ([]*model.Assignment, error)

FetchAll all assignment from the database

func (*AssignmentRepository) Insert

func (repo *AssignmentRepository) Insert(assignment model.Assignment) (int, error)

Insert an assignment into the database

func (*AssignmentRepository) Update

func (repo *AssignmentRepository) Update(assignment model.Assignment) error

Update assignment in the database

type CourseRepository

type CourseRepository struct {
	// contains filtered or unexported fields
}

CourseRepository represents the layer between the database and the Course-model

func NewCourseRepository

func NewCourseRepository(db *sql.DB) *CourseRepository

NewCourseRepository returns a pointer to a new CourseRepository

func (*CourseRepository) Delete

func (repo *CourseRepository) Delete(id int) error

Delete course from the database, based on course ID

func (*CourseRepository) Fetch

func (repo *CourseRepository) Fetch(id int) (*model.Course, error)

Fetch a single course from the database

func (*CourseRepository) FetchAll

func (repo *CourseRepository) FetchAll() ([]*model.Course, error)

FetchAll courses from the database

func (*CourseRepository) FetchAllForUser

func (repo *CourseRepository) FetchAllForUser(userID int) ([]*model.Course, error)

FetchAllForUser fetches all courses for a given user

func (*CourseRepository) FetchAllForUserOrdered

func (repo *CourseRepository) FetchAllForUserOrdered(userID int) ([]*model.Course, error)

FetchAllForUserOrdered all courses for a user, ordered

func (*CourseRepository) FetchAllStudentsFromCourse

func (repo *CourseRepository) FetchAllStudentsFromCourse(courseID int) ([]*model.User, error)

FetchAllStudentsFromCourse func

func (*CourseRepository) Insert

func (repo *CourseRepository) Insert(course model.Course) (int, error)

Insert course to the database

func (*CourseRepository) InsertUser

func (repo *CourseRepository) InsertUser(userID int, courseID int) error

InsertUser to a course, gives a relationship between a user and a course in the database

func (*CourseRepository) RemoveUser

func (repo *CourseRepository) RemoveUser(userID, courseID int) error

RemoveUser removes the relationship between a user and a course in the database

func (*CourseRepository) Update

func (repo *CourseRepository) Update(course model.Course) error

Update func

func (*CourseRepository) UserInCourse

func (repo *CourseRepository) UserInCourse(userID, courseID int) (bool, error)

UserInCourse checks if user is in given course

type FAQRepository

type FAQRepository struct {
	// contains filtered or unexported fields
}

FAQRepository struct

func NewFAQRepository

func NewFAQRepository(db *sql.DB) *FAQRepository

NewFAQRepository func

func (*FAQRepository) Fetch

func (repo *FAQRepository) Fetch() (*model.Faq, error)

Fetch fetches the faq in db

func (*FAQRepository) InsertNew

func (repo *FAQRepository) InsertNew() error

InsertNew inserts a new faq to db

func (*FAQRepository) Update

func (repo *FAQRepository) Update(questions string) error

Update updates the faq in db

type FieldRepository

type FieldRepository struct {
	// contains filtered or unexported fields
}

FieldRepository struct

func NewFieldRepository

func NewFieldRepository(db *sql.DB) *FieldRepository

NewFieldRepository func

func (*FieldRepository) DeleteAll

func (repo *FieldRepository) DeleteAll(formID int) error

DeleteAll func

func (*FieldRepository) Fetch

func (repo *FieldRepository) Fetch(id int) (*model.Field, error)

Fetch func

func (*FieldRepository) FetchAll

func (repo *FieldRepository) FetchAll() ([]*model.Field, error)

FetchAll func

func (*FieldRepository) FetchAllFromForm

func (repo *FieldRepository) FetchAllFromForm(formID int) ([]*model.Field, error)

FetchAllFromForm func

func (*FieldRepository) Insert

func (repo *FieldRepository) Insert(field *model.Field) (int, error)

Insert func

func (*FieldRepository) Update

func (repo *FieldRepository) Update(id int, field *model.Field) error

Update func

type FormRepository

type FormRepository struct {
	// contains filtered or unexported fields
}

FormRepository struct

func NewFormRepository

func NewFormRepository(db *sql.DB) *FormRepository

NewFormRepository func

func (*FormRepository) Delete

func (repo *FormRepository) Delete(id int) error

Delete func

func (*FormRepository) Fetch

func (repo *FormRepository) Fetch(id int) (*model.Form, error)

Fetch func

func (*FormRepository) FetchAll

func (repo *FormRepository) FetchAll() ([]*model.Form, error)

FetchAll func

func (*FormRepository) Insert

func (repo *FormRepository) Insert(form *model.Form) (int, error)

Insert func

func (*FormRepository) Update

func (repo *FormRepository) Update(id int, form *model.Form) error

Update func

type GroupRepository

type GroupRepository struct {
	// contains filtered or unexported fields
}

GroupRepository struct

func NewGroupRepository

func NewGroupRepository(db *sql.DB) *GroupRepository

NewGroupRepository func

func (*GroupRepository) AddUser

func (repo *GroupRepository) AddUser(groupID, userID int) error

AddUser to a group

func (*GroupRepository) Fetch

func (repo *GroupRepository) Fetch(groupID, assignmentID int) (*model.Group, error)

Fetch single group

func (*GroupRepository) FetchAll

func (repo *GroupRepository) FetchAll(assignmentID int) ([]*model.Group, error)

FetchAll groups from an assignment

func (*GroupRepository) FetchGroupForUser

func (repo *GroupRepository) FetchGroupForUser(userID, assignmentID int) (*model.Group, error)

FetchGroupForUser fetches the group for a user on an assignment

func (*GroupRepository) FetchUsers

func (repo *GroupRepository) FetchUsers(groupID int) ([]int, error)

FetchUsers gets all users in a group

func (*GroupRepository) FetchUsersFromGroup

func (repo *GroupRepository) FetchUsersFromGroup(groupID int) ([]*model.User, error)

FetchUsersFromGroup fetches all users from a group

func (*GroupRepository) FetchUsersInGroups

func (repo *GroupRepository) FetchUsersInGroups(assignmentID int) ([]int, error)

FetchUsersInGroups fetches all users who are in group in a given assigment

func (*GroupRepository) Insert

func (repo *GroupRepository) Insert(group model.Group) (int64, error)

Insert group into database

func (*GroupRepository) RemoveUser

func (repo *GroupRepository) RemoveUser(groupID, userID int) error

RemoveUser to a group

func (*GroupRepository) Update

func (repo *GroupRepository) Update(group model.Group) error

Update group in database

type LogsRepository

type LogsRepository struct {
	// contains filtered or unexported fields
}

LogsRepository struct

func NewLogsRepository

func NewLogsRepository(db *sql.DB) *LogsRepository

NewLogsRepository func

func (*LogsRepository) FetchAllWithNameAndRole

func (repo *LogsRepository) FetchAllWithNameAndRole() ([]*model.Logs, error)

FetchAllWithNameAndRole fetches all logs

func (*LogsRepository) Insert

func (repo *LogsRepository) Insert(logx model.Logs) error

Insert inserts all types of logs

type PeerReviewRepository

type PeerReviewRepository struct {
	// contains filtered or unexported fields
}

PeerReviewRepository struct

func NewPeerReviewRepository

func NewPeerReviewRepository(db *sql.DB) *PeerReviewRepository

NewPeerReviewRepository func

func (*PeerReviewRepository) FetchPeerReviewsFromAssignment

func (repo *PeerReviewRepository) FetchPeerReviewsFromAssignment(assignmentID int) ([]*model.PeerReview, error)

FetchPeerReviewsFromAssignment func

func (*PeerReviewRepository) FetchReviewTargetsToUser

func (repo *PeerReviewRepository) FetchReviewTargetsToUser(userID int, assignmentID int) ([]*model.PeerReview, error)

FetchReviewTargetsToUser func

func (*PeerReviewRepository) Insert

func (repo *PeerReviewRepository) Insert(assignmentID int, userID int, targetUserID int) (bool, error)

Insert func

func (*PeerReviewRepository) TargetExists

func (repo *PeerReviewRepository) TargetExists(assignmentID int, userID int) (bool, error)

TargetExists Checks if the target exist in the table

type ReviewAnswerRepository

type ReviewAnswerRepository struct {
	// contains filtered or unexported fields
}

ReviewAnswerRepository struct

func NewReviewAnswerRepository

func NewReviewAnswerRepository(db *sql.DB) *ReviewAnswerRepository

NewReviewAnswerRepository func

func (*ReviewAnswerRepository) CountReviewsDone

func (repo *ReviewAnswerRepository) CountReviewsDone(userID, assignmentID int) (int, error)

CountReviewsDone func

func (*ReviewAnswerRepository) CountReviewsDoneOnAssignment

func (repo *ReviewAnswerRepository) CountReviewsDoneOnAssignment(assignmentID int) (int, error)

CountReviewsDoneOnAssignment func

func (*ReviewAnswerRepository) DeleteTarget

func (repo *ReviewAnswerRepository) DeleteTarget(assignmentID, userID int) error

DeleteTarget func

func (*ReviewAnswerRepository) FetchForAssignment

func (repo *ReviewAnswerRepository) FetchForAssignment(assignmentID int) ([]*model.ReviewAnswer, error)

FetchForAssignment func

func (*ReviewAnswerRepository) FetchForReviewer

func (repo *ReviewAnswerRepository) FetchForReviewer(reviewer, assignmentID int) ([]*model.ReviewAnswer, error)

FetchForReviewer func

func (*ReviewAnswerRepository) FetchForReviewerAndTarget

func (repo *ReviewAnswerRepository) FetchForReviewerAndTarget(reviewer, target, assignmentID int) ([]*model.ReviewAnswer, error)

FetchForReviewerAndTarget func

func (*ReviewAnswerRepository) FetchForTarget

func (repo *ReviewAnswerRepository) FetchForTarget(target, assignmentID int) ([]*model.ReviewAnswer, error)

FetchForTarget func

func (*ReviewAnswerRepository) FetchRawReviewForUser

func (repo *ReviewAnswerRepository) FetchRawReviewForUser(userID, assignmentID int) ([]*model.ReviewAnswer, error)

FetchRawReviewForUser func

func (*ReviewAnswerRepository) Insert

func (repo *ReviewAnswerRepository) Insert(answer model.ReviewAnswer) (int, error)

Insert func

func (*ReviewAnswerRepository) MaxScore

func (repo *ReviewAnswerRepository) MaxScore(assignmentID int) (int, error)

MaxScore func

func (*ReviewAnswerRepository) Update

func (repo *ReviewAnswerRepository) Update(targetID, reviewerID, assignmentID int, answer model.ReviewAnswer) error

Update review answer and comment

type ReviewRepository

type ReviewRepository struct {
	// contains filtered or unexported fields
}

ReviewRepository struct

func NewReviewRepository

func NewReviewRepository(db *sql.DB) *ReviewRepository

NewReviewRepository func

func (*ReviewRepository) DeleteWithFormID

func (repo *ReviewRepository) DeleteWithFormID(id int) error

DeleteWithFormID func

func (*ReviewRepository) Fetch

func (repo *ReviewRepository) Fetch(id int) (*model.Review, error)

Fetch func

func (*ReviewRepository) FetchAll

func (repo *ReviewRepository) FetchAll() ([]*model.Review, error)

FetchAll func

func (*ReviewRepository) FetchFromFormID

func (repo *ReviewRepository) FetchFromFormID(formID int) (*model.Review, error)

FetchFromFormID fetches review from formID

func (*ReviewRepository) FetchReviewUsers

func (repo *ReviewRepository) FetchReviewUsers(userID, assignmentID int) ([]*model.User, error)

FetchReviewUsers func

func (*ReviewRepository) Insert

func (repo *ReviewRepository) Insert(form model.Form) (int, error)

Insert func

func (*ReviewRepository) IsUsed

func (repo *ReviewRepository) IsUsed(id int) (bool, error)

IsUsed func

func (*ReviewRepository) IsUserTheReviewer

func (repo *ReviewRepository) IsUserTheReviewer(reviewer int, target int, assignment int) (bool, error)

IsUserTheReviewer func

func (*ReviewRepository) Update

func (repo *ReviewRepository) Update(id int, review model.Review) error

Update func

func (*ReviewRepository) UsedInAssignment

func (repo *ReviewRepository) UsedInAssignment(id int) (int, error)

UsedInAssignment func

type SubmissionAnswerRepository

type SubmissionAnswerRepository struct {
	// contains filtered or unexported fields
}

SubmissionAnswerRepository struct

func NewSubmissionAnswerRepository

func NewSubmissionAnswerRepository(db *sql.DB) *SubmissionAnswerRepository

NewSubmissionAnswerRepository func

func (*SubmissionAnswerRepository) CountForAssignment

func (repo *SubmissionAnswerRepository) CountForAssignment(assignmentID int) (int, error)

CountForAssignment func

func (*SubmissionAnswerRepository) Delete

func (repo *SubmissionAnswerRepository) Delete(assignmentID, userID int) error

Delete func

func (*SubmissionAnswerRepository) DeleteFromAssignment

func (repo *SubmissionAnswerRepository) DeleteFromAssignment(assignmentID int) error

DeleteFromAssignment func

func (*SubmissionAnswerRepository) Fetch

Fetch func

func (*SubmissionAnswerRepository) FetchAll

func (repo *SubmissionAnswerRepository) FetchAll() ([]*model.SubmissionAnswer, error)

FetchAll func

func (*SubmissionAnswerRepository) FetchAllForAssignment

func (repo *SubmissionAnswerRepository) FetchAllForAssignment(assignmentID int) ([]*model.SubmissionAnswer, error)

FetchAllForAssignment func

func (*SubmissionAnswerRepository) FetchAllForUserAndAssignment

func (repo *SubmissionAnswerRepository) FetchAllForUserAndAssignment(userID, assignmentID int) ([]*model.SubmissionAnswer, error)

FetchAllForUserAndAssignment func

func (*SubmissionAnswerRepository) FetchSubmittedTime

func (repo *SubmissionAnswerRepository) FetchSubmittedTime(userID, assignmentID int) (time.Time, bool, error)

FetchSubmittedTime func

func (*SubmissionAnswerRepository) FetchUsersDeliveredFromAssignment

func (repo *SubmissionAnswerRepository) FetchUsersDeliveredFromAssignment(assignmentID int) ([]int, error)

FetchUsersDeliveredFromAssignment func

func (*SubmissionAnswerRepository) Insert

func (repo *SubmissionAnswerRepository) Insert(answer model.SubmissionAnswer) (int, error)

Insert func

func (*SubmissionAnswerRepository) Update

Update func

type SubmissionRepository

type SubmissionRepository struct {
	// contains filtered or unexported fields
}

SubmissionRepository struct

func NewSubmissionRepository

func NewSubmissionRepository(db *sql.DB) *SubmissionRepository

NewSubmissionRepository func

func (*SubmissionRepository) DeleteByFormID

func (repo *SubmissionRepository) DeleteByFormID(id int) error

DeleteByFormID deletes submission based on form_id

func (*SubmissionRepository) DeleteWithFormID

func (repo *SubmissionRepository) DeleteWithFormID(id int) error

DeleteWithFormID deletes submission based on form_id

func (*SubmissionRepository) Fetch

func (repo *SubmissionRepository) Fetch(id int) (*model.Submission, error)

Fetch func

func (*SubmissionRepository) FetchAll

func (repo *SubmissionRepository) FetchAll() ([]*model.Submission, error)

FetchAll func

func (*SubmissionRepository) FetchFromFormID

func (repo *SubmissionRepository) FetchFromFormID(formID int) (*model.Submission, error)

FetchFromFormID fetches submission from formID

func (*SubmissionRepository) Insert

func (repo *SubmissionRepository) Insert(form model.Form) (int, error)

Insert func

func (*SubmissionRepository) IsUsed

func (repo *SubmissionRepository) IsUsed(id int) (bool, error)

IsUsed check if submission is used

func (*SubmissionRepository) Update

func (repo *SubmissionRepository) Update(id int, submission model.Submission) error

Update func

func (*SubmissionRepository) UsedInAssignment

func (repo *SubmissionRepository) UsedInAssignment(id int) (int, error)

UsedInAssignment func

type UserPendingRepository

type UserPendingRepository struct {
	// contains filtered or unexported fields
}

UserPendingRepository struct

func NewUserPendingRepository

func NewUserPendingRepository(db *sql.DB) *UserPendingRepository

NewUserPendingRepository func

func (*UserPendingRepository) FetchAll

FetchAll fetches all userPending in the db, but not the password

func (*UserPendingRepository) FetchPassword

func (repo *UserPendingRepository) FetchPassword(id int) (string, error)

FetchPassword fetches the password to one user through the id

func (*UserPendingRepository) Insert

func (repo *UserPendingRepository) Insert(pending model.UserRegistrationPending) (int, error)

Insert inserts a new userPending in the db

func (*UserPendingRepository) InsertNewEmail

func (repo *UserPendingRepository) InsertNewEmail(pending model.UserRegistrationPending) (int, error)

InsertNewEmail inserts a new userPending for emails in the db

type UserRepository

type UserRepository struct {
	// contains filtered or unexported fields
}

UserRepository struct

func NewUserRepository

func NewUserRepository(db *sql.DB) *UserRepository

NewUserRepository return a pointer to a new UserRepository

func (*UserRepository) Delete

func (repo *UserRepository) Delete(id int) error

Delete a user

func (*UserRepository) EmailExists

func (repo *UserRepository) EmailExists(email string) (bool, int, error)

EmailExists Checks if a user with said email exists and returns userid

func (*UserRepository) Fetch

func (repo *UserRepository) Fetch(id int) (*model.User, error)

Fetch a user

func (*UserRepository) FetchAll

func (repo *UserRepository) FetchAll() ([]*model.User, error)

FetchAll users from the database

func (*UserRepository) FetchAllFromCourse

func (repo *UserRepository) FetchAllFromCourse(courseID int) ([]*model.User, error)

FetchAllFromCourse fetches all course participants in sorted list by teacher, name

func (*UserRepository) FetchHash

func (repo *UserRepository) FetchHash(id int) (string, error)

FetchHash hashed password for a user

func (*UserRepository) Insert

func (repo *UserRepository) Insert(user model.User, password string) (int, error)

Insert user to the database

func (*UserRepository) Update

func (repo *UserRepository) Update(id int, user model.User) error

Update user in the database

func (*UserRepository) UpdatePassword

func (repo *UserRepository) UpdatePassword(id int, hashedPassword string) error

UpdatePassword for a user

type ValidationRepository

type ValidationRepository struct {
	// contains filtered or unexported fields
}

ValidationRepository struct

func NewValidationRepository

func NewValidationRepository(db *sql.DB) *ValidationRepository

NewValidationRepository func

func (*ValidationRepository) FetchAll

func (repo *ValidationRepository) FetchAll() ([]*model.ValidationEmail, error)

FetchAll fetches all validation rows

func (*ValidationRepository) Insert

func (repo *ValidationRepository) Insert(validation model.ValidationEmail) (int, error)

Insert inserts a new validation row in the db

func (*ValidationRepository) UpdateValidation

func (repo *ValidationRepository) UpdateValidation(id int, state bool) error

UpdateValidation updates the validation column

Jump to

Keyboard shortcuts

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