Documentation
¶
Index ¶
- func TestUserCreate(t *testing.T)
- func TestUserDeleteById(t *testing.T)
- func TestUserFindByEmail(t *testing.T)
- func TestUserFindByName(t *testing.T)
- func TestUserGetAll(t *testing.T)
- func TestUserGetById(t *testing.T)
- func TestUserUpdate(t *testing.T)
- type BaseRepository
- func (r *BaseRepository) Create(entity any) (any, error)
- func (r *BaseRepository) DeleteId(id uint) error
- func (r *BaseRepository) DeleteVersioned(id uint, version uint) error
- func (r *BaseRepository) Find(entity any) (any, error)
- func (r *BaseRepository) GetAll() (any, error)
- func (r *BaseRepository) GetId(id uint) (any, error)
- func (r *BaseRepository) GetLatestId() (uint, error)
- func (r *BaseRepository) GetLatestVersion(id uint) (uint, error)
- func (r *BaseRepository) GetLatestVersioned(id uint) (any, error)
- func (r *BaseRepository) GetNextId() (uint, error)
- func (r *BaseRepository) GetNextVersion(id uint) (uint, error)
- func (r *BaseRepository) GetTimed(id uint, startDate time.Time) (any, error)
- func (r *BaseRepository) GetType() reflect.Type
- func (r *BaseRepository) GetVersioned(id uint, version uint) (any, error)
- func (r *BaseRepository) Update(entity any) error
- type ConversionRepository
- type CourseRepository
- type CurriculumRepository
- type CurriculumtypeRepository
- type EvaluationtypeRepository
- type ExamEvaluationRepository
- func (r *ExamEvaluationRepository) DeleteExamEvaluation(id, registeredById, selectedCourseUserId, selectedCourseCourseId, ... uint, ...) error
- func (r *ExamEvaluationRepository) GetByCourseAndYear(selectedCourseCourseId, selectedCourseCourseVersion uint, ...) (examEvaluations []models.ExamEvaluation, err error)
- func (r *ExamEvaluationRepository) GetExamEvaluation(id, registeredById, selectedCourseUserId, selectedCourseCourseId, ... uint, ...) (examEvaluation models.ExamEvaluation, err error)
- type ExamRepository
- type ExamtypeRepository
- type FieldRepository
- type FocusRepository
- type GradetypeRepository
- type IdRepository
- type ModuleRepository
- type Repository
- type RoleRepository
- type SelectedCourseRepository
- func (r *SelectedCourseRepository) DeleteSelectedCourse(userId, courseId, courseVersion uint, classStartyear time.Time) error
- func (r *SelectedCourseRepository) GetSelectedCourse(userId, courseId, courseVersion uint, classStartyear time.Time) (selectedCourse models.SelectedCourse, err error)
- func (r *SelectedCourseRepository) GetSelectedCourseByYear(courseId, courseVersion uint, classStartyear time.Time) (selectedCourses []models.SelectedCourse, err error)
- type StateRepository
- type StudyStageRepository
- type TimedRepository
- type UserRepository
- type VersionedRepository
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func TestUserCreate ¶
func TestUserDeleteById ¶
func TestUserFindByEmail ¶
func TestUserFindByName ¶
func TestUserGetAll ¶
func TestUserGetById ¶
func TestUserUpdate ¶
Types ¶
type BaseRepository ¶
BaseRepository is a base repository that contains the database connection and CRUD operations
func NewBaseRepository ¶
func NewBaseRepository(provider db.Provider, entity any) *BaseRepository
Constructor for BaseRepository
func (*BaseRepository) Create ¶
func (r *BaseRepository) Create(entity any) (any, error)
Creates new Entity on the DB.
WARNING: Expect Pointer or else it will panic
Usage (example with models.Course):
newCourse, err := repository.Create(&course)
func (*BaseRepository) DeleteId ¶
func (r *BaseRepository) DeleteId(id uint) error
Delete entity by providing the id
Usage (example with models.Field):
err := respository.DeleteId(1)
func (*BaseRepository) DeleteVersioned ¶
func (r *BaseRepository) DeleteVersioned(id uint, version uint) error
Delete entity by providing the id and version
Usage (example with models.Course):
err := respository.DeleteVersioned(1, 2)
func (*BaseRepository) Find ¶
func (r *BaseRepository) Find(entity any) (any, error)
Get list of entitys providing a entity
Usage (example with models.Course):
res, err := repository.Find(course) courses := res.([]models.Course)
func (*BaseRepository) GetAll ¶
func (r *BaseRepository) GetAll() (any, error)
Gets list of entity from DB
Usage (example with models.Course):
res, err := repository.GetAll() courses := res.([]models.Course)
func (*BaseRepository) GetId ¶
func (r *BaseRepository) GetId(id uint) (any, error)
Get entity by providing the id
Usage (example with models.Field)
res, err := repository.GetId(3) field := res.(*models.Field)
func (*BaseRepository) GetLatestId ¶
func (r *BaseRepository) GetLatestId() (uint, error)
returns currently highest used id
func (*BaseRepository) GetLatestVersion ¶
func (r *BaseRepository) GetLatestVersion(id uint) (uint, error)
returns currently highest used version
func (*BaseRepository) GetLatestVersioned ¶
func (r *BaseRepository) GetLatestVersioned(id uint) (any, error)
Get entity with the highest version, providing the id
Usage (example with models.Course):
res, err := repository.GetLatestVersioned(1) course := res.(*models.Course)
func (*BaseRepository) GetNextId ¶
func (r *BaseRepository) GetNextId() (uint, error)
returns next possible id for the entity (manual autoincrement)
func (*BaseRepository) GetNextVersion ¶
func (r *BaseRepository) GetNextVersion(id uint) (uint, error)
returns next possible version for the entity (manual autoincrement)
func (*BaseRepository) GetTimed ¶
Get entity by providing the id and startdate
Usage (example with models.Conversion):
res, err := repository.GetTimed(1, time.Date(2024, time.January, 1, 0, 0, 0, 0, time.UTC)) conversion := res.(*models.Conversion)
func (*BaseRepository) GetType ¶
func (r *BaseRepository) GetType() reflect.Type
Return the type of the entity as a reflect.Type
func (*BaseRepository) GetVersioned ¶
func (r *BaseRepository) GetVersioned(id uint, version uint) (any, error)
Get entity by providing the id and version
Usage (example with models.Course)
res, err := repository.GetVersioned(1, 2) course := result.(*models.Course)
func (*BaseRepository) Update ¶
func (r *BaseRepository) Update(entity any) error
Updates Entity on the DB.
Usage (example with models.Course):
err := repository.Update(&course)
type ConversionRepository ¶
type ConversionRepository struct {
*BaseRepository
}
func NewConversionRepository ¶
func NewConversionRepository(provider db.Provider) *ConversionRepository
func (*ConversionRepository) DeleteTimed ¶
func (r *ConversionRepository) DeleteTimed(id uint, startDate time.Time) error
type CourseRepository ¶
type CourseRepository struct {
*BaseRepository
}
func NewCourseRepository ¶
func NewCourseRepository(provider db.Provider) *CourseRepository
type CurriculumRepository ¶
type CurriculumRepository struct {
*BaseRepository
}
func NewCurriculumRepository ¶
func NewCurriculumRepository(provider db.Provider) *CurriculumRepository
func (*CurriculumRepository) DeleteTimed ¶
func (r *CurriculumRepository) DeleteTimed(id uint, startDate time.Time) error
type CurriculumtypeRepository ¶
type CurriculumtypeRepository struct {
*BaseRepository
}
func NewCurriculumtypeRepository ¶
func NewCurriculumtypeRepository(provider db.Provider) *CurriculumtypeRepository
type EvaluationtypeRepository ¶
type EvaluationtypeRepository struct {
*BaseRepository
}
func NewEvaluationtypeRepository ¶
func NewEvaluationtypeRepository(provider db.Provider) *EvaluationtypeRepository
type ExamEvaluationRepository ¶
type ExamEvaluationRepository struct {
*BaseRepository
}
func NewExamEvaluationRepository ¶
func NewExamEvaluationRepository(provider db.Provider) *ExamEvaluationRepository
func (*ExamEvaluationRepository) DeleteExamEvaluation ¶
func (r *ExamEvaluationRepository) DeleteExamEvaluation(id, registeredById, selectedCourseUserId, selectedCourseCourseId, selectedCourseCourseVersion, examId uint, selectedCourseClassStartyear time.Time) error
func (*ExamEvaluationRepository) GetByCourseAndYear ¶
func (r *ExamEvaluationRepository) GetByCourseAndYear(selectedCourseCourseId, selectedCourseCourseVersion uint, selectedCourseClassStartyear time.Time) (examEvaluations []models.ExamEvaluation, err error)
func (*ExamEvaluationRepository) GetExamEvaluation ¶
func (r *ExamEvaluationRepository) GetExamEvaluation( id, registeredById, selectedCourseUserId, selectedCourseCourseId, selectedCourseCourseVersion, examId uint, selectedCourseClassStartyear time.Time) (examEvaluation models.ExamEvaluation, err error)
type ExamRepository ¶
type ExamRepository struct {
*BaseRepository
}
func NewExamRepository ¶
func NewExamRepository(provider db.Provider) *ExamRepository
type ExamtypeRepository ¶
type ExamtypeRepository struct {
*BaseRepository
}
func NewExamtypeRepository ¶
func NewExamtypeRepository(provider db.Provider) *ExamtypeRepository
type FieldRepository ¶
type FieldRepository struct {
*BaseRepository
}
func NewFieldRepository ¶
func NewFieldRepository(provider db.Provider) *FieldRepository
type FocusRepository ¶
type FocusRepository struct {
*BaseRepository
}
func NewFocusRepository ¶
func NewFocusRepository(provider db.Provider) *FocusRepository
type GradetypeRepository ¶
type GradetypeRepository struct {
*BaseRepository
}
func NewGradetypeRepository ¶
func NewGradetypeRepository(provider db.Provider) *GradetypeRepository
type IdRepository ¶
type IdRepository interface {
GetId(id uint) (any, error)
DeleteId(id uint) error
GetLatestId() (uint, error)
GetNextId() (uint, error)
}
Repository methods for models with only an id
type ModuleRepository ¶
type ModuleRepository struct {
*BaseRepository
}
func NewModuleRepository ¶
func NewModuleRepository(provider db.Provider) *ModuleRepository
type Repository ¶
type RoleRepository ¶
type RoleRepository struct {
*BaseRepository
}
func NewRoleRepository ¶
func NewRoleRepository(provider db.Provider) *RoleRepository
type SelectedCourseRepository ¶
type SelectedCourseRepository struct {
*BaseRepository
}
func NewSelectedCourseRepository ¶
func NewSelectedCourseRepository(provider db.Provider) *SelectedCourseRepository
func (*SelectedCourseRepository) DeleteSelectedCourse ¶
func (r *SelectedCourseRepository) DeleteSelectedCourse( userId, courseId, courseVersion uint, classStartyear time.Time) error
func (*SelectedCourseRepository) GetSelectedCourse ¶
func (r *SelectedCourseRepository) GetSelectedCourse( userId, courseId, courseVersion uint, classStartyear time.Time) (selectedCourse models.SelectedCourse, err error)
func (*SelectedCourseRepository) GetSelectedCourseByYear ¶
func (r *SelectedCourseRepository) GetSelectedCourseByYear(courseId, courseVersion uint, classStartyear time.Time) (selectedCourses []models.SelectedCourse, err error)
type StateRepository ¶
type StateRepository struct {
*BaseRepository
}
func NewStateRepository ¶
func NewStateRepository(provider db.Provider) *StateRepository
type StudyStageRepository ¶
type StudyStageRepository struct {
*BaseRepository
}
func NewStudyStageRepository ¶
func NewStudyStageRepository(provider db.Provider) *StudyStageRepository
type TimedRepository ¶
type TimedRepository interface {
GetTimed(id uint, startDate time.Time) (any, error)
DeleteTimed(id uint, startDate time.Time) error
GetLatestId() (uint, error)
GetNextId() (uint, error)
}
Repository methods for models with id and start date
type UserRepository ¶
type UserRepository struct {
*BaseRepository
}
func NewUserRepository ¶
func NewUserRepository(provider db.Provider) *UserRepository
type VersionedRepository ¶
type VersionedRepository interface {
GetVersioned(id uint, version uint) (any, error)
DeleteVersioned(id uint, version uint) error
GetLatestVersioned(id uint) (any, error)
GetLatestId() (uint, error)
GetNextId() (uint, error)
GetLatestVersion(id uint) (uint, error)
GetNextVersion(id uint) (uint, error)
}
Repository methods for models with id and version