database

package
v0.0.0-...-128d701 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2019 License: GPL-3.0 Imports: 3 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewClassRepository

func NewClassRepository(sqlHandler SqlHandler) (repository.ClassRepository, error)

func NewCommentRepository

func NewCommentRepository(sqlHandler SqlHandler) repository.CommentRepository

func NewHelpRepository

func NewHelpRepository(sqlHandler SqlHandler) (repository.HelpRepository, error)

func NewLectureRepository

func NewLectureRepository(sqlHandler SqlHandler) (repository.LectureRepository, error)

func NewParticipationRepository

func NewParticipationRepository(sqlHandler SqlHandler) (repository.ParticipationRepository, error)

func NewTaskRepository

func NewTaskRepository(sqlHandler SqlHandler) (repository.TaskRepository, error)

func NewUserRepository

func NewUserRepository(sqlHandler SqlHandler) (repository.UserRepository, error)

Types

type ClassRepository

type ClassRepository struct {
	SqlHandler
}

func (*ClassRepository) CreateClass

func (repo *ClassRepository) CreateClass(class *model.Class) (*model.Class, error)

func (*ClassRepository) DeleteClass

func (repo *ClassRepository) DeleteClass(id int64, lectureID int64) (int64, error)

func (*ClassRepository) GetClassById

func (repo *ClassRepository) GetClassById(id int64) (class *model.Class, err error)

func (*ClassRepository) GetClassesByLectureID

func (repo *ClassRepository) GetClassesByLectureID(lectureID int64, limit int, offset int) (model.Classes, error)

func (*ClassRepository) UpdateClass

func (repo *ClassRepository) UpdateClass(class *model.Class) (*model.Class, error)

type CommentRepository

type CommentRepository struct {
	SqlHandler
}

func (*CommentRepository) CreateComment

func (repo *CommentRepository) CreateComment(comment *model.Comment) (*model.Comment, error)

func (*CommentRepository) DeleteComment

func (repo *CommentRepository) DeleteComment(id int64, userType model.UserType, userID int64) (int64, error)

func (*CommentRepository) GetCommentsByHelpID

func (repo *CommentRepository) GetCommentsByHelpID(helpID int64, limit int, offset int) (model.Comments, error)

func (*CommentRepository) GetCommentsByUserTypeAndUserID

func (repo *CommentRepository) GetCommentsByUserTypeAndUserID(userType model.UserType, userID int64, limit int, offset int) (model.Comments, error)

func (*CommentRepository) UpdateComment

func (repo *CommentRepository) UpdateComment(comment *model.Comment) (*model.Comment, error)

type HelpRepository

type HelpRepository struct {
	SqlHandler
}

func (*HelpRepository) CreateHelp

func (repo *HelpRepository) CreateHelp(help *model.Help) (*model.Help, error)

func (*HelpRepository) DeleteHelp

func (repo *HelpRepository) DeleteHelp(id int64, lectureID int64, studentID int64) (int64, error)

func (*HelpRepository) DeleteHelpWithoutStudentId

func (repo *HelpRepository) DeleteHelpWithoutStudentId(id int64, lectureID int64) (int64, error)

func (*HelpRepository) GetHelpsByLectureID

func (repo *HelpRepository) GetHelpsByLectureID(lectureID int64, limit int, offset int) (model.Helps, error)

func (*HelpRepository) GetHelpsByStudentID

func (repo *HelpRepository) GetHelpsByStudentID(studentID int64, limit int, offset int) (model.Helps, error)

func (*HelpRepository) UpdateHelp

func (repo *HelpRepository) UpdateHelp(help *model.Help) (*model.Help, error)

type LectureRepository

type LectureRepository struct {
	SqlHandler
}

func (*LectureRepository) CreateLecture

func (repo *LectureRepository) CreateLecture(lecture *model.Lecture) (*model.Lecture, error)

func (*LectureRepository) DeleteLecture

func (repo *LectureRepository) DeleteLecture(id int64) (int64, error)

func (*LectureRepository) GetLectureById

func (repo *LectureRepository) GetLectureById(id int64) (lecture *model.Lecture, err error)

func (*LectureRepository) GetLectures

func (repo *LectureRepository) GetLectures(limit int, offset int) (total int64, lectures model.Lectures, err error)

func (*LectureRepository) GetParticipatedLecturesOfAssistant

func (repo *LectureRepository) GetParticipatedLecturesOfAssistant(studentID int64, limit int, offset int) (total int64, lectures model.Lectures, err error)

func (*LectureRepository) GetParticipatedLecturesOfStudent

func (repo *LectureRepository) GetParticipatedLecturesOfStudent(studentID int64, limit int, offset int) (total int64, lectures model.Lectures, err error)

func (*LectureRepository) GetParticipatedLecturesOfTeacher

func (repo *LectureRepository) GetParticipatedLecturesOfTeacher(teacherID int64, limit int, offset int) (total int64, lectures model.Lectures, err error)

func (*LectureRepository) UpdateLecture

func (repo *LectureRepository) UpdateLecture(lecture *model.Lecture) (*model.Lecture, error)

type ParticipationRepository

type ParticipationRepository struct {
	SqlHandler
}

func (*ParticipationRepository) CreateAssistantLecture

func (repo *ParticipationRepository) CreateAssistantLecture(assistantLecture *model.AssistantLecture) (*model.AssistantLecture, error)

func (*ParticipationRepository) CreateStudentLecture

func (repo *ParticipationRepository) CreateStudentLecture(studentLecture *model.StudentLecture) (*model.StudentLecture, error)

func (*ParticipationRepository) CreateTeacherLecture

func (repo *ParticipationRepository) CreateTeacherLecture(teacherLecture *model.TeacherLecture) (*model.TeacherLecture, error)

func (*ParticipationRepository) DeleteAssistantLecture

func (repo *ParticipationRepository) DeleteAssistantLecture(studentID int64, lectureID int64) (int64, error)

func (*ParticipationRepository) DeleteStudentLecture

func (repo *ParticipationRepository) DeleteStudentLecture(studentID int64, lectureID int64) (int64, error)

func (*ParticipationRepository) DeleteTeacherLecture

func (repo *ParticipationRepository) DeleteTeacherLecture(teacherID int64, lectureID int64) (int64, error)

type Result

type Result interface {
	LastInsertId() (int64, error)
	RowAffected() (int64, error)
}

type Row

type Row interface {
	Scan(...interface{}) error
	Next() bool
	Close() error
}

type SqlHandler

type SqlHandler interface {
	Execute(string, ...interface{}) (Result, error)
	Query(string, ...interface{}) (Row, error)
}

type TaskRepository

type TaskRepository struct {
	SqlHandler
}

func (*TaskRepository) CreateTask

func (repo *TaskRepository) CreateTask(task *model.Task) (*model.Task, error)

func (*TaskRepository) DeleteTask

func (repo *TaskRepository) DeleteTask(id int64, classID int64) (int64, error)

func (*TaskRepository) GetTasksByClassId

func (repo *TaskRepository) GetTasksByClassId(classID int64, limit int, offset int) (model.Tasks, error)

func (*TaskRepository) UpdateTask

func (repo *TaskRepository) UpdateTask(task *model.Task) (*model.Task, error)

type UserRepository

type UserRepository struct {
	SqlHandler
}

func (*UserRepository) GetAdminByEmail

func (repo *UserRepository) GetAdminByEmail(email string) (admin *model.Admin, err error)

func (*UserRepository) GetAdminById

func (repo *UserRepository) GetAdminById(adminId int64) (admin *model.Admin, err error)

func (*UserRepository) GetAssistantById

func (repo *UserRepository) GetAssistantById(assistantId int64) (assistant *model.Assistant, err error)

func (*UserRepository) GetAssistantByStudentNo

func (repo *UserRepository) GetAssistantByStudentNo(studentNo string) (assistant *model.Assistant, err error)

func (*UserRepository) GetAssistants

func (repo *UserRepository) GetAssistants(limit, offset int) (assistants model.Assistants, err error)

func (*UserRepository) GetParticipatingAssistantsOfLecture

func (repo *UserRepository) GetParticipatingAssistantsOfLecture(lectureID int64, limit int, offset int) (assistants model.Assistants, err error)

func (*UserRepository) GetParticipatingStudentsOfLecture

func (repo *UserRepository) GetParticipatingStudentsOfLecture(lectureID int64, limit int, offset int) (students model.Students, err error)

func (*UserRepository) GetParticipatingTeachersOfLecture

func (repo *UserRepository) GetParticipatingTeachersOfLecture(lectureID int64, limit int, offset int) (teachers model.Teachers, err error)

func (*UserRepository) GetStudentById

func (repo *UserRepository) GetStudentById(studentId int64) (student *model.Student, err error)

func (*UserRepository) GetStudentByStudentNo

func (repo *UserRepository) GetStudentByStudentNo(studentNo string) (student *model.Student, err error)

func (*UserRepository) GetStudents

func (repo *UserRepository) GetStudents(limit, offset int) (students model.Students, err error)

func (*UserRepository) GetTeacherByEmail

func (repo *UserRepository) GetTeacherByEmail(email string) (teacher *model.Teacher, err error)

func (*UserRepository) GetTeacherById

func (repo *UserRepository) GetTeacherById(teacherId int64) (teacher *model.Teacher, err error)

func (*UserRepository) GetTeachers

func (repo *UserRepository) GetTeachers(limit, offset int) (teachers model.Teachers, err error)

func (*UserRepository) InsertAdmin

func (repo *UserRepository) InsertAdmin(admin *model.Admin) (*model.Admin, error)

func (*UserRepository) InsertAssistant

func (repo *UserRepository) InsertAssistant(assistant *model.Assistant) (*model.Assistant, error)

func (*UserRepository) InsertStudent

func (repo *UserRepository) InsertStudent(student *model.Student) (*model.Student, error)

func (*UserRepository) InsertTeacher

func (repo *UserRepository) InsertTeacher(teacher *model.Teacher) (*model.Teacher, error)

func (*UserRepository) UpdateAssistant

func (repo *UserRepository) UpdateAssistant(assistant *model.Assistant) (*model.Assistant, error)

func (*UserRepository) UpdateStudent

func (repo *UserRepository) UpdateStudent(student *model.Student) (*model.Student, error)

func (*UserRepository) UpdateTeacher

func (repo *UserRepository) UpdateTeacher(teacher *model.Teacher) (*model.Teacher, error)

Jump to

Keyboard shortcuts

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