Documentation ¶
Index ¶
- Variables
- func DefaultIndexDirFunc[T FileStorable, K store.Storer[T]](s *FileStore[T, K]) error
- func DefaultQuizIndexDirFunc(s *QuizFileStore) error
- func GetDefaultCollectionsDir() string
- func GetDefaultExamsDir() string
- func GetDefaultGroupsDir() string
- func GetDefaultParticipantsDir() string
- func GetDefaultQuizzesDir() string
- func GetDefaultResponsesDir() string
- func GetDefaultSessionDir() string
- type ExamFileStore
- type FilePathConfig
- type FileStorable
- type FileStore
- func (s *FileStore[T, K]) Create(entity T, path ...string) (T, error)
- func (s *FileStore[T, K]) Delete(id string) (T, error)
- func (s *FileStore[T, K]) GetPath(entity T) string
- func (s *FileStore[T, K]) IndexDir() error
- func (s *FileStore[T, K]) Read(id string) (T, error)
- func (s *FileStore[T, K]) ReadAll() []T
- func (s *FileStore[T, K]) SetPath(entity T, path string) string
- func (s *FileStore[T, K]) Update(entity T, id string) (T, error)
- type FileStoreConfig
- type FileStorer
- type IndexDirFunc
- type ParticipantFileStore
- type QuizFileStore
- type ResponseFileStore
- type SessionFileStore
Constants ¶
This section is empty.
Variables ¶
View Source
var ( DefaultBaseDir = "data" DefaultQuizzesSubdir = "quizzes" DefaultCollectionsSubdir = "collections" DefaultParticipantsSubdir = "participants" DefaultGroupsSubdir = "groups" DefaultExamsSubdir = "exams" DefaultResponsesSubdir = "responses" DefaultSessionSubdir = "sessions" Dirs = []string{ GetDefaultQuizzesDir(), GetDefaultParticipantsDir(), GetDefaultExamsDir(), GetDefaultSessionDir(), } )
View Source
var (
ErrorMetaHeaderIsNotPresent = errors.New("Meta header was not found in file.")
)
Functions ¶
func DefaultIndexDirFunc ¶
func DefaultIndexDirFunc[T FileStorable, K store.Storer[T]](s *FileStore[T, K]) error
func DefaultQuizIndexDirFunc ¶
func DefaultQuizIndexDirFunc(s *QuizFileStore) error
func GetDefaultCollectionsDir ¶
func GetDefaultCollectionsDir() string
func GetDefaultExamsDir ¶
func GetDefaultExamsDir() string
func GetDefaultGroupsDir ¶
func GetDefaultGroupsDir() string
func GetDefaultParticipantsDir ¶
func GetDefaultParticipantsDir() string
func GetDefaultQuizzesDir ¶
func GetDefaultQuizzesDir() string
func GetDefaultResponsesDir ¶
func GetDefaultResponsesDir() string
func GetDefaultSessionDir ¶
func GetDefaultSessionDir() string
Types ¶
type ExamFileStore ¶
func NewDefaultExamFileStore ¶
func NewDefaultExamFileStore() (*ExamFileStore, error)
func NewExamFileStore ¶
func NewExamFileStore(config *FileStoreConfig[*models.Exam, *store.ExamStore]) (*ExamFileStore, error)
type FilePathConfig ¶
type FileStorable ¶
type FileStore ¶
type FileStore[T FileStorable, K store.Storer[T]] struct { *FileStoreConfig[T, K] Storer K // contains filtered or unexported fields }
func NewFileStore ¶
func NewFileStore[T FileStorable, K store.Storer[T]](config *FileStoreConfig[T, K], storer K) (*FileStore[T, K], error)
type FileStoreConfig ¶
type FileStoreConfig[T FileStorable, K store.Storer[T]] struct { FilePathConfig IndexDirFunc func(*FileStore[T, K]) error CreateEntityFunc func() T NoIndexOnCreate bool }
type FileStorer ¶
type IndexDirFunc ¶
type IndexDirFunc[T FileStorable, K store.Storer[T]] func(s *FileStore[T, K]) error
type ParticipantFileStore ¶
type ParticipantFileStore struct { *FileStore[*models.Participant, *store.ParticipantStore] }
func NewDefaultParticipantFileStore ¶
func NewDefaultParticipantFileStore() (*ParticipantFileStore, error)
func NewParticipantFileStore ¶
func NewParticipantFileStore(config *FileStoreConfig[*models.Participant, *store.ParticipantStore]) (*ParticipantFileStore, error)
func (*ParticipantFileStore) ImportCSV ¶
func (ps *ParticipantFileStore) ImportCSV(path string) ([]*models.Participant, error)
type QuizFileStore ¶
func NewDefaultQuizFileStore ¶
func NewDefaultQuizFileStore() (*QuizFileStore, error)
func NewQuizFileStore ¶
func NewQuizFileStore(config *FileStoreConfig[*models.Quiz, *store.QuizStore]) (*QuizFileStore, error)
type ResponseFileStore ¶
func NewDefaultResponseFileStore ¶
func NewDefaultResponseFileStore() (*ResponseFileStore, error)
func NewResponseFileStore ¶
func NewResponseFileStore(config *FileStoreConfig[*models.Response, *store.ResponseStore]) (*ResponseFileStore, error)
func NewResponseFileStoreWithPath ¶
func NewResponseFileStoreWithPath(path string) (*ResponseFileStore, error)
type SessionFileStore ¶
type SessionFileStore = FileStore[*models.Session, *store.SessionStore]
func NewDefaultSessionFileStore ¶
func NewDefaultSessionFileStore() (*SessionFileStore, error)
func NewSessionFileStore ¶
func NewSessionFileStore(config *FileStoreConfig[*models.Session, *store.SessionStore]) (*SessionFileStore, error)
func NewSessionFileStoreWithPath ¶
func NewSessionFileStoreWithPath(path string) (*SessionFileStore, error)
Click to show internal directories.
Click to hide internal directories.