Documentation ¶
Index ¶
- Variables
- func GetSystemSpaceID() userD.SpaceID
- func GetSystemStudentID() userD.AppUserID
- func GetTatoebaWorkbookID() domain.WorkbookID
- func InitAppProperties(systemSpaceID userD.SpaceID, systemStudentID userD.AppUserID, ...)
- func SetSystemSpaceID(propertiesSystemSpaceID userD.SpaceID)
- func SetSystemStudentID(propertiesSystemStudentID userD.AppUserID)
- func SetTatoebaWorkbookID(propertiesTatoebaWorkbookID domain.WorkbookID)
- type Audio
- type CountAnsweredResult
- type CountAnsweredResults
- type GuestStudent
- type Problem
- type ProblemAddParameterIterator
- type ProblemAddProcessor
- type ProblemEvent
- type ProblemEventType
- type ProblemFeature
- type ProblemImportProcessor
- type ProblemMonitor
- type ProblemObserver
- type ProblemQuotaHandler
- type ProblemQuotaProcessor
- type ProblemRemoveProcessor
- type ProblemRepository
- type ProblemTypeRepository
- type ProblemUpdateProcessor
- type ProblemWithResults
- type ProcessorFactory
- type QuotaName
- type QuotaUnit
- type Recordbook
- type RecordbookRepository
- type RecordbookSummary
- type RepositoryFactory
- type Stat
- type StatRepository
- type Student
- type StudyEvent
- type StudyEventType
- type StudyMonitor
- type StudyObserver
- type StudyRecordRepository
- type StudyStatRepository
- type StudyTypeRepository
- type SynthesizerClient
- type SystemStudent
- type Transaction
- type UserQuotaRepository
- type Workbook
- type WorkbookRepository
Constants ¶
This section is empty.
Variables ¶
View Source
var ( SystemStudentLoginID = "system-student" TatoebaWorkbookName = "tatoeba" OrganizationName = "cocotola" )
View Source
var ( ErrQuotaExceeded = errors.New("quota exceeded") QuotaUnitPersitance QuotaUnit = "persitance" QuotaUnitMonth QuotaUnit = "month" QuotaUnitDay QuotaUnit = "day" QuotaNameSize QuotaName = "Size" QuotaNameUpdate QuotaName = "Update" )
View Source
var ErrAudioNotFound = errors.New("audio not found")
View Source
var ErrProblemAlreadyExists = errors.New("problem already exists")
View Source
var ErrProblemNotFound = errors.New("problem not found")
View Source
var ErrProblemOtherError = errors.New("problem other error")
View Source
var ErrStudyResultNotFound = errors.New("StudyResult not found")
View Source
var ErrWorkbookAlreadyExists = errors.New("workbook already exists")
View Source
var ErrWorkbookNotFound = errors.New("workbook not found")
View Source
var ErrWorkbookPermissionDenied = errors.New("permission denied")
Functions ¶
func GetSystemSpaceID ¶
func GetSystemStudentID ¶
func GetTatoebaWorkbookID ¶
func GetTatoebaWorkbookID() domain.WorkbookID
func InitAppProperties ¶
func SetSystemSpaceID ¶
func SetSystemStudentID ¶
func SetTatoebaWorkbookID ¶
func SetTatoebaWorkbookID(propertiesTatoebaWorkbookID domain.WorkbookID)
Types ¶
type Audio ¶
type Audio interface {
GetAudioModel() domain.AudioModel
}
type CountAnsweredResult ¶
type CountAnsweredResults ¶
type CountAnsweredResults struct {
Results []CountAnsweredResult
}
type GuestStudent ¶
type GuestStudent interface { domain.StudentModel GetDefaultSpace(ctx context.Context) (userS.Space, error) FindWorkbooksFromPublicSpace(ctx context.Context, condition domain.WorkbookSearchCondition) (domain.WorkbookSearchResult, error) }
func NewGuestStudent ¶
func NewGuestStudent(ctx context.Context, pf ProcessorFactory, rf RepositoryFactory, studentModel domain.StudentModel) (GuestStudent, error)
type Problem ¶
type Problem interface { domain.ProblemModel ProblemFeature }
func NewProblem ¶
func NewProblem(synthesizerClient SynthesizerClient, problemModel domain.ProblemModel) (Problem, error)
type ProblemAddParameterIterator ¶
type ProblemAddParameterIterator interface {
Next() (domain.ProblemAddParameter, error)
}
type ProblemAddProcessor ¶
type ProblemAddProcessor interface {
AddProblem(ctx context.Context, repo RepositoryFactory, operator domain.StudentModel, workbookModel domain.WorkbookModel, param domain.ProblemAddParameter) ([]domain.ProblemID, []domain.ProblemID, []domain.ProblemID, error)
}
type ProblemEvent ¶
type ProblemEvent interface { GetOrganizationID() userD.OrganizationID GetAppUserID() userD.AppUserID GetProblemEventType() ProblemEventType GetProblemType() domain.ProblemTypeName GetProblemIDs() []domain.ProblemID }
func NewProblemEvent ¶
func NewProblemEvent(organizationID userD.OrganizationID, appUserID userD.AppUserID, problemEventType ProblemEventType, problemType domain.ProblemTypeName, problemIDs []domain.ProblemID) ProblemEvent
type ProblemEventType ¶
type ProblemEventType int
const ProblemEventTypeAdd ProblemEventType = 1
const ProblemEventTypeRemove ProblemEventType = 3
const ProblemEventTypeUpdate ProblemEventType = 2
type ProblemFeature ¶
type ProblemFeature interface { }
type ProblemImportProcessor ¶
type ProblemImportProcessor interface {
CreateCSVReader(ctx context.Context, workbookID domain.WorkbookID, reader io.Reader) (ProblemAddParameterIterator, error)
}
type ProblemMonitor ¶
type ProblemMonitor interface { Attach(observer ProblemObserver) error Detach(observer ProblemObserver) error NotifyObservers(ctx context.Context, event ProblemEvent) error }
func NewProblemMonitor ¶
func NewProblemMonitor() ProblemMonitor
type ProblemObserver ¶
type ProblemObserver interface {
Update(ctx context.Context, problemNotification ProblemEvent) error
}
type ProblemQuotaHandler ¶
type ProblemQuotaHandler interface { ProblemObserver }
type ProblemQuotaProcessor ¶
type ProblemRemoveProcessor ¶
type ProblemRemoveProcessor interface {
RemoveProblem(ctx context.Context, repo RepositoryFactory, operator domain.StudentModel, id domain.ProblemSelectParameter2) ([]domain.ProblemID, []domain.ProblemID, []domain.ProblemID, error)
}
type ProblemRepository ¶
type ProblemRepository interface { // FindProblems searches for problems based on search condition FindProblems(ctx context.Context, operator domain.StudentModel, param domain.ProblemSearchCondition) (domain.ProblemSearchResult, error) FindAllProblems(ctx context.Context, operator domain.StudentModel, workbookID domain.WorkbookID) (domain.ProblemSearchResult, error) FindProblemsByProblemIDs(ctx context.Context, operator domain.StudentModel, param domain.ProblemIDsCondition) (domain.ProblemSearchResult, error) FindProblemsByCustomCondition(ctx context.Context, operator domain.StudentModel, condition interface{}) ([]domain.ProblemModel, error) FindProblemByID(ctx context.Context, operator domain.StudentModel, id domain.ProblemSelectParameter1) (Problem, error) FindProblemIDs(ctx context.Context, operator domain.StudentModel, workbookID domain.WorkbookID) ([]domain.ProblemID, error) // AddProblem register a new problem AddProblem(ctx context.Context, operator domain.StudentModel, param domain.ProblemAddParameter) (domain.ProblemID, error) UpdateProblem(ctx context.Context, operator domain.StudentModel, id domain.ProblemSelectParameter2, param domain.ProblemUpdateParameter) error UpdateProblemProperty(ctx context.Context, operator domain.StudentModel, id domain.ProblemSelectParameter2, param domain.ProblemUpdateParameter) error RemoveProblem(ctx context.Context, operator domain.StudentModel, id domain.ProblemSelectParameter2) error CountProblems(ctx context.Context, operator domain.StudentModel, workbookID domain.WorkbookID) (int, error) }
type ProblemTypeRepository ¶
type ProblemTypeRepository interface {
FindAllProblemTypes(ctx context.Context) ([]domain.ProblemType, error)
}
type ProblemUpdateProcessor ¶
type ProblemUpdateProcessor interface { UpdateProblem(ctx context.Context, repo RepositoryFactory, operator domain.StudentModel, workbookModel domain.WorkbookModel, id domain.ProblemSelectParameter2, param domain.ProblemUpdateParameter) ([]domain.ProblemID, []domain.ProblemID, []domain.ProblemID, error) UpdateProblemProperty(ctx context.Context, repo RepositoryFactory, operator domain.StudentModel, workbookModel domain.WorkbookModel, id domain.ProblemSelectParameter2, param domain.ProblemUpdateParameter) ([]domain.ProblemID, []domain.ProblemID, []domain.ProblemID, error) }
type ProblemWithResults ¶
type ProblemWithResults interface { domain.ProblemModel GetResults() []bool GetLevel() int }
func NewProblemWithResults ¶
func NewProblemWithResults(problem domain.ProblemModel, results []bool, level int) ProblemWithResults
type ProcessorFactory ¶
type ProcessorFactory interface { NewProblemAddProcessor(problemType domain.ProblemTypeName) (ProblemAddProcessor, error) NewProblemUpdateProcessor(problemType domain.ProblemTypeName) (ProblemUpdateProcessor, error) NewProblemRemoveProcessor(problemType domain.ProblemTypeName) (ProblemRemoveProcessor, error) NewProblemImportProcessor(problemType domain.ProblemTypeName) (ProblemImportProcessor, error) NewProblemQuotaProcessor(problemType domain.ProblemTypeName) (ProblemQuotaProcessor, error) }
func NewProcessorFactory ¶
func NewProcessorFactory(addProcessors map[domain.ProblemTypeName]ProblemAddProcessor, updateProcessors map[domain.ProblemTypeName]ProblemUpdateProcessor, removeProcessors map[domain.ProblemTypeName]ProblemRemoveProcessor, importProcessors map[domain.ProblemTypeName]ProblemImportProcessor, quotaProcessors map[domain.ProblemTypeName]ProblemQuotaProcessor) ProcessorFactory
type Recordbook ¶
type Recordbook interface { GetStudent() Student GetWorkbookID() domain.WorkbookID GetResults(ctx context.Context) (map[domain.ProblemID]domain.StudyRecord, error) GetResultsSortedLevel(ctx context.Context) ([]domain.StudyRecordWithProblemID, error) SetResult(ctx context.Context, problemType domain.ProblemTypeName, problemID domain.ProblemID, result, mastered bool) error }
func NewRecordbook ¶
func NewRecordbook(rf RepositoryFactory, student Student, workbookID domain.WorkbookID, studyType domain.StudyTypeName) (Recordbook, error)
type RecordbookRepository ¶
type RecordbookRepository interface { FindStudyRecords(ctx context.Context, operator domain.StudentModel, workbookID domain.WorkbookID, studyType domain.StudyTypeName) (map[domain.ProblemID]domain.StudyRecord, error) SetResult(ctx context.Context, operator domain.StudentModel, workbookID domain.WorkbookID, studyType domain.StudyTypeName, problemType domain.ProblemTypeName, problemID domain.ProblemID, studyResult, mastered bool) error CountMasteredProblems(ctx context.Context, operator domain.StudentModel, workbookID domain.WorkbookID) (map[domain.StudyTypeName]int, error) }
type RecordbookSummary ¶
type RecordbookSummary interface {
GetCompletionRate(ctx context.Context) (map[domain.StudyTypeName]int, error)
}
func NewRecordbookSummary ¶
func NewRecordbookSummary(rf RepositoryFactory, student Student, workbookID domain.WorkbookID) (RecordbookSummary, error)
type RepositoryFactory ¶
type RepositoryFactory interface { NewWorkbookRepository(ctx context.Context) WorkbookRepository NewProblemRepository(ctx context.Context, problemType domain.ProblemTypeName) (ProblemRepository, error) NewProblemTypeRepository(ctx context.Context) ProblemTypeRepository NewStudyTypeRepository(ctx context.Context) StudyTypeRepository NewStudyRecordRepository(ctx context.Context) StudyRecordRepository NewRecordbookRepository(ctx context.Context) RecordbookRepository NewUserQuotaRepository(ctx context.Context) UserQuotaRepository NewStatRepository(ctx context.Context) StatRepository NewStudyStatRepository(ctx context.Context) StudyStatRepository NewUserRepositoryFactory(ctx context.Context) (userS.RepositoryFactory, error) NewJobRepositoryFactory(ctx context.Context) (jobS.RepositoryFactory, error) }
type StatRepository ¶
type Student ¶
type Student interface { domain.StudentModel GetDefaultSpace(ctx context.Context) (userS.Space, error) GetPersonalSpace(ctx context.Context) (userS.Space, error) FindWorkbooksFromPersonalSpace(ctx context.Context, condition domain.WorkbookSearchCondition) (domain.WorkbookSearchResult, error) FindWorkbookByID(ctx context.Context, id domain.WorkbookID) (Workbook, error) FindWorkbookByName(ctx context.Context, name string) (Workbook, error) AddWorkbookToPersonalSpace(ctx context.Context, parameter domain.WorkbookAddParameter) (domain.WorkbookID, error) UpdateWorkbook(ctx context.Context, workbookID domain.WorkbookID, version int, parameter domain.WorkbookUpdateParameter) error RemoveWorkbook(ctx context.Context, id domain.WorkbookID, version int) error CheckQuota(ctx context.Context, problemType domain.ProblemTypeName, name QuotaName) error FindRecordbook(ctx context.Context, workbookID domain.WorkbookID, studyType domain.StudyTypeName) (Recordbook, error) FindRecordbookSummary(ctx context.Context, workbookID domain.WorkbookID) (RecordbookSummary, error) GetStat(ctx context.Context) (Stat, error) FindPreferences(ctx context.Context) (userS.UserPreferences, error) }
func NewStudent ¶
func NewStudent(ctx context.Context, pf ProcessorFactory, rf RepositoryFactory, studentModel domain.StudentModel) (Student, error)
type StudyEvent ¶
type StudyEvent interface { GetOrganizationID() userD.OrganizationID GetAppUserID() userD.AppUserID GetStudyEventType() StudyEventType GetProblemType() domain.ProblemTypeName GetStudyType() domain.StudyTypeName GetProblemID() domain.ProblemID }
func NewStudyEvent ¶
func NewStudyEvent(organizationID userD.OrganizationID, appUserID userD.AppUserID, studyEventType StudyEventType, problemType domain.ProblemTypeName, studyType domain.StudyTypeName, problemID domain.ProblemID) StudyEvent
type StudyMonitor ¶
type StudyMonitor interface { Attach(observer StudyObserver) error Detach(observer StudyObserver) error NotifyObservers(ctx context.Context, event StudyEvent) error }
func NewStudyMonitor ¶
func NewStudyMonitor() StudyMonitor
type StudyObserver ¶
type StudyObserver interface {
Update(ctx context.Context, studyNotification StudyEvent) error
}
type StudyRecordRepository ¶
type StudyRecordRepository interface { AddRecord(ctx context.Context, operator domain.StudentModel, workbookID domain.WorkbookID, problemType domain.ProblemTypeName, studyType domain.StudyTypeName, problemID domain.ProblemID, mastered bool) error CountAnsweredProblems(ctx context.Context, operator userD.SystemOwnerModel, targetUserID userD.AppUserID, targetDate time.Time) (*CountAnsweredResults, error) }
type StudyStatRepository ¶
type StudyTypeRepository ¶
type SynthesizerClient ¶
type SystemStudent ¶
type SystemStudent interface { domain.SystemStudentModel FindWorkbookFromSystemSpace(ctx context.Context, name string) (Workbook, error) AddWorkbookToSystemSpace(ctx context.Context, parameter domain.WorkbookAddParameter) (domain.WorkbookID, error) }
func NewSystemStudent ¶
func NewSystemStudent(rf RepositoryFactory, systemStudentModel domain.SystemStudentModel) (SystemStudent, error)
type Transaction ¶
type Transaction interface {
Do(ctx context.Context, fn func(rf RepositoryFactory) error) error
}
type UserQuotaRepository ¶
type UserQuotaRepository interface { IsExceeded(ctx context.Context, organizationID userD.OrganizationID, appUserID userD.AppUserID, name string, unit QuotaUnit, limit int) (bool, error) Increment(ctx context.Context, organizationID userD.OrganizationID, appUserID userD.AppUserID, name string, unit QuotaUnit, limit int, count int) (bool, error) }
type Workbook ¶
type Workbook interface { domain.WorkbookModel // FindProblems searches for problems based on search condition FindProblems(ctx context.Context, operator domain.StudentModel, param domain.ProblemSearchCondition) (domain.ProblemSearchResult, error) FindAllProblems(ctx context.Context, operator domain.StudentModel) (domain.ProblemSearchResult, error) FindProblemsByProblemIDs(ctx context.Context, operator domain.StudentModel, param domain.ProblemIDsCondition) (domain.ProblemSearchResult, error) FindProblemIDs(ctx context.Context, operator domain.StudentModel) ([]domain.ProblemID, error) // FindProblems searches for problem based on a problem ID FindProblemByID(ctx context.Context, operator domain.StudentModel, problemID domain.ProblemID) (Problem, error) AddProblem(ctx context.Context, operator domain.StudentModel, param domain.ProblemAddParameter) ([]domain.ProblemID, []domain.ProblemID, []domain.ProblemID, error) UpdateProblem(ctx context.Context, operator domain.StudentModel, id domain.ProblemSelectParameter2, param domain.ProblemUpdateParameter) ([]domain.ProblemID, []domain.ProblemID, []domain.ProblemID, error) UpdateProblemProperty(ctx context.Context, operator domain.StudentModel, id domain.ProblemSelectParameter2, param domain.ProblemUpdateParameter) ([]domain.ProblemID, []domain.ProblemID, []domain.ProblemID, error) RemoveProblem(ctx context.Context, operator domain.StudentModel, id domain.ProblemSelectParameter2) ([]domain.ProblemID, []domain.ProblemID, []domain.ProblemID, error) UpdateWorkbook(ctx context.Context, operator domain.StudentModel, version int, parameter domain.WorkbookUpdateParameter) error RemoveWorkbook(ctx context.Context, operator domain.StudentModel, version int) error CountProblems(ctx context.Context, operator domain.StudentModel) (int, error) }
func NewWorkbook ¶
func NewWorkbook(ctx context.Context, rf RepositoryFactory, pf ProcessorFactory, workbookModel domain.WorkbookModel) (Workbook, error)
type WorkbookRepository ¶
type WorkbookRepository interface { FindPersonalWorkbooks(ctx context.Context, operator domain.StudentModel, param domain.WorkbookSearchCondition) (domain.WorkbookSearchResult, error) FindWorkbookByID(ctx context.Context, operator domain.StudentModel, id domain.WorkbookID) (Workbook, error) FindWorkbookByName(ctx context.Context, operator userD.AppUserModel, spaceID userD.SpaceID, name string) (Workbook, error) AddWorkbook(ctx context.Context, operator userD.AppUserModel, spaceID userD.SpaceID, param domain.WorkbookAddParameter) (domain.WorkbookID, error) UpdateWorkbook(ctx context.Context, operator domain.StudentModel, workbookID domain.WorkbookID, version int, param domain.WorkbookUpdateParameter) error RemoveWorkbook(ctx context.Context, operator domain.StudentModel, workbookID domain.WorkbookID, version int) error }
Source Files ¶
- app_properties.go
- audio.go
- guest_student.go
- problem.go
- problem_iterrator.go
- problem_observer.go
- problem_processor.go
- problem_quota_handler.go
- problem_repository.go
- problem_type_repository.go
- processor_factory.go
- recordbook.go
- recordbook_repository.go
- repository_factory.go
- stat.go
- stat_repository.go
- student.go
- study_observer.go
- study_record_repository.go
- study_stat_repository.go
- study_type_repository.go
- synthesizer_client.go
- system_student.go
- transaction.go
- user_quota_repository.go
- workbook.go
- workbook_repository.go
Click to show internal directories.
Click to hide internal directories.