persistence

package
v0.0.0-...-5f5a93c Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDB

func NewDB(env *env.EnvConfig) *sqlx.DB

Types

type AcademicFieldRepositoryImpl

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

func NewAcademicFieldRepositoryImpl

func NewAcademicFieldRepositoryImpl(db *sqlx.DB) *AcademicFieldRepositoryImpl

func (*AcademicFieldRepositoryImpl) Get

func (afR *AcademicFieldRepositoryImpl) Get() ([]string, error)

type ResourceRepositoryImpl

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

func NewResourceRepositoryImpl

func NewResourceRepositoryImpl(db *sqlx.DB) *ResourceRepositoryImpl

func (*ResourceRepositoryImpl) GetByIds

func (vR *ResourceRepositoryImpl) GetByIds(ids []model.ResourceId) ([]*model.Resource, error)

type SubjectRepositoryImpl

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

func NewSubjectRepositoryImpl

func NewSubjectRepositoryImpl(db *sqlx.DB) *SubjectRepositoryImpl

func (*SubjectRepositoryImpl) GetById

func (*SubjectRepositoryImpl) GetByIds

func (sR *SubjectRepositoryImpl) GetByIds(ids []model.SubjectId) ([]*model.Subject, error)

FIXME: this causes N+1 query problem

func (SubjectRepositoryImpl) GetByRandom

func (sR SubjectRepositoryImpl) GetByRandom(
	category string,
	series string,
	academicField string,
	numSubjects int) ([]*model.Subject, error)

WARNING: This method become slower as the number of subjects increases due to LIMIT clause. This also causes N+1 query problem.

func (SubjectRepositoryImpl) GetBySearchParameter

func (sR SubjectRepositoryImpl) GetBySearchParameter(title string, faculty string, academicField string) ([]*model.Subject, error)

func (SubjectRepositoryImpl) GetByVideoIds

func (sR SubjectRepositoryImpl) GetByVideoIds(videoIds []model.VideoId) ([]*model.Subject, error)

type SyllabusRepositoryImpl

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

func NewSyllabusRepositoryImpl

func NewSyllabusRepositoryImpl(db *sqlx.DB) *SyllabusRepositoryImpl

func (*SyllabusRepositoryImpl) GetById

func (*SyllabusRepositoryImpl) GetByIds

func (sR *SyllabusRepositoryImpl) GetByIds(ids []model.SyllabusId) ([]*model.Syllabus, error)

type VideoRepositoryImpl

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

func NewVideoRepositoryImpl

func NewVideoRepositoryImpl(db *sqlx.DB) *VideoRepositoryImpl

func (*VideoRepositoryImpl) GetByIds

func (vR *VideoRepositoryImpl) GetByIds(ids []model.VideoId) ([]*model.Video, error)

GetByIds returns videos with the given ids. This function is expected to get videos of one subject.

func (*VideoRepositoryImpl) GetBySearchParameter

func (vR *VideoRepositoryImpl) GetBySearchParameter(title string, faculty string) ([]*model.Video, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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