Documentation ¶
Index ¶
- type AccountRepository
- type Repositories
- type StudyConfRepository
- type StudyRepository
- func (r *StudyRepository) CreateStudy(ctx context.Context, name, userId string) (types.Study, error)
- func (r *StudyRepository) GetStudies(ctx context.Context, offset int, limit int, userId string) ([]types.Study, error)
- func (r *StudyRepository) GetStudyBySlug(ctx context.Context, slug, userId 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
func (*AccountRepository) Create ¶
Create creates a new account object in the database
Accounts Map to the Credentials table in the database in the following way:
Name -> entity (This is used as the "Source") ConnectedAccount.Credentials -> details AuthType -> key UserId -> user_id
user_id, entity, key need to be unique, therefore currently we will not allow more than one instance of an account Type i.e You can only connect one Fly Instance
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 string, ) (types.Study, error)
CreateStudy used to do the row creation in the database for the study objects
func (*StudyRepository) GetStudies ¶
func (*StudyRepository) GetStudyBySlug ¶
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 string, ) ([]types.SegmentsProgress, error)
type UserRepository ¶
type UserRepository struct {
// contains filtered or unexported fields
}
func NewUserRepository ¶
func NewUserRepository(db *sql.DB) *UserRepository