Documentation ¶
Index ¶
- type AccountRepository
- type Repositories
- type StudyConfRepository
- type StudyRepository
- func (r *StudyRepository) CreateStudy(ctx context.Context, name, userID, orgID string) (types.Study, error)
- func (r *StudyRepository) GetStudies(ctx context.Context, offset int, limit int, userID, orgID string) ([]types.Study, error)
- func (r *StudyRepository) GetStudyBySlug(ctx context.Context, slug, userID, orgID string) (types.Study, error)
- type StudySegmentsRepository
- type UserRepository
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccountRepository ¶
type AccountRepository struct {
// contains filtered or unexported fields
}
func NewAccountRepository ¶
func NewAccountRepository(db *sql.DB) *AccountRepository
type Repositories ¶
type Repositories struct { Db *sql.DB Study types.StudyRepository StudySegments types.StudySegmentsRepository User types.UserRepository Account types.AccountRepository StudyConf types.StudyConfRepository }
func InitializeRepositories ¶
func InitializeRepositories(dbURI string) Repositories
type StudyConfRepository ¶
type StudyConfRepository struct {
// contains filtered or unexported fields
}
func NewStudyConfRepository ¶
func NewStudyConfRepository(db *sql.DB) *StudyConfRepository
func (*StudyConfRepository) Create ¶
func (r *StudyConfRepository) Create( ctx context.Context, sc types.DatabaseStudyConf, ) error
Create creates a new study_conf object in the database NOTE: Study Configs have no unique identifiers and this function will not have logic to check for duplicates
func (*StudyConfRepository) GetByStudySlug ¶
func (r *StudyConfRepository) GetByStudySlug( ctx context.Context, slug, userID string, ) ([]*types.DatabaseStudyConf, error)
GetConfsByStudy will return all the latest unique confs that are attached to a study
type StudyRepository ¶
type StudyRepository struct {
// contains filtered or unexported fields
}
func NewStudyRepository ¶
func NewStudyRepository(db *sql.DB) *StudyRepository
NewStudyRepository returns a new instance of the Study Repository object to manage calls to the database
func (*StudyRepository) CreateStudy ¶
func (r *StudyRepository) CreateStudy( ctx context.Context, name, userID, orgID string, ) (types.Study, error)
CreateStudy used to do the row creation in the database for the study objects
func (*StudyRepository) GetStudies ¶
func (r *StudyRepository) GetStudies( ctx context.Context, offset int, limit int, userID, orgID string, ) ([]types.Study, error)
GetStudies returns a paginated list of studies based on an offset and limit
func (*StudyRepository) GetStudyBySlug ¶
func (r *StudyRepository) GetStudyBySlug( ctx context.Context, slug, userID, orgID string, ) (types.Study, error)
GetStudyBySlug fetches a study by using the slug
type StudySegmentsRepository ¶
type StudySegmentsRepository struct {
// contains filtered or unexported fields
}
func NewStudySegmentsRepository ¶
func NewStudySegmentsRepository(db *sql.DB) *StudySegmentsRepository
func (*StudySegmentsRepository) GetByStudySlug ¶
func (r *StudySegmentsRepository) GetByStudySlug( ctx context.Context, slug, userID, orgID string, ) ([]types.SegmentsProgress, error)
GetByStudySlug fetches the segment progress from the adopt_reports table by the study slug
type UserRepository ¶
type UserRepository struct {
// contains filtered or unexported fields
}
func NewUserRepository ¶
func NewUserRepository(db *sql.DB) *UserRepository
func (*UserRepository) GetUserOrgIDs ¶
GetUserOrgID returns a users org id based on their user id