12345678910111213141516171819202122232425262728 |
- package file
- import (
- "git.andreafazzi.eu/andrea/probo/models"
- "git.andreafazzi.eu/andrea/probo/store"
- )
- type ExamFileStore = FileStore[*models.Exam, *store.Store[*models.Exam]]
- func NewExamFileStore(config *FileStoreConfig[*models.Exam, *store.ExamStore]) (*ExamFileStore, error) {
- return NewFileStore[*models.Exam](config, store.NewStore[*models.Exam]())
- }
- func NewDefaultExamFileStore() (*ExamFileStore, error) {
- return NewExamFileStore(
- &FileStoreConfig[*models.Exam, *store.ExamStore]{
- FilePathConfig: FilePathConfig{GetDefaultExamsDir(), "exam", ".json"},
- IndexDirFunc: DefaultIndexDirFunc[*models.Exam, *store.ExamStore],
- CreateEntityFunc: func() *models.Exam {
- return &models.Exam{
- Participant: &models.Participant{},
- Quizzes: make([]*models.Quiz, 0),
- }
- },
- },
- )
- }
|