Documentation ¶
Overview ¶
Package repositories implements an in-memory store for representing the data of the files scanned
Index ¶
- type DefaultFileRepository
- func (fr DefaultFileRepository) AudioSize() int
- func (fr DefaultFileRepository) Delete(filePath string) error
- func (fr DefaultFileRepository) DeleteAllData()
- func (fr DefaultFileRepository) Exists(filePath string) bool
- func (fr DefaultFileRepository) GetAll() *domain.FileList
- func (fr DefaultFileRepository) GetByDate(folderDate string) *domain.FileList
- func (fr DefaultFileRepository) GetByEventId(eventId int) *domain.FileList
- func (fr DefaultFileRepository) GetByPath(filePath string) *domain.FileInfo
- func (fr DefaultFileRepository) GetForHour(hour string) *domain.FileList
- func (fr DefaultFileRepository) LoadFromDisk(fileName string) error
- func (fr DefaultFileRepository) NewFiles() (newFiles bool)
- func (fr DefaultFileRepository) SaveToDisk(fileName string) error
- func (fr DefaultFileRepository) Size() int
- func (fr DefaultFileRepository) Store(fi domain.FileInfo) error
- func (fr DefaultFileRepository) StreamSize() int
- type FileRepository
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DefaultFileRepository ¶
func NewFileRepository ¶
func NewFileRepository(cfg *config.AppConfig) DefaultFileRepository
NewFileRepository creates a new file repository. You need to pass in the configuration
func (DefaultFileRepository) AudioSize ¶
func (fr DefaultFileRepository) AudioSize() int
AudioSize returns the number of audio files (as identified by their file extension) stored in the repository
func (DefaultFileRepository) Delete ¶
func (fr DefaultFileRepository) Delete(filePath string) error
Delete delete a file information entry from the repository, if it exists
func (DefaultFileRepository) DeleteAllData ¶
func (fr DefaultFileRepository) DeleteAllData()
DeleteAllData removes all entries from the repository
func (DefaultFileRepository) Exists ¶
func (fr DefaultFileRepository) Exists(filePath string) bool
Exists checks whether a file identified by its path exists in the repository
func (DefaultFileRepository) GetAll ¶
func (fr DefaultFileRepository) GetAll() *domain.FileList
GetAll returns all file data from the repository. Returns nil if repository is empty
func (DefaultFileRepository) GetByDate ¶ added in v1.3.0
func (fr DefaultFileRepository) GetByDate(folderDate string) *domain.FileList
GetByDate returns all file data from the repository for a specific folder date. Returns nil if repository is empty or no files match
func (DefaultFileRepository) GetByEventId ¶ added in v1.2.0
func (fr DefaultFileRepository) GetByEventId(eventId int) *domain.FileList
GetByEventId returns a file's information where the file is identified by its event id (from calCMS). If no file matches, the methods returns nil
func (DefaultFileRepository) GetByPath ¶ added in v1.2.0
func (fr DefaultFileRepository) GetByPath(filePath string) *domain.FileInfo
GetByPath returns a file's information where the file is identified by its path. If no file matches, the methods returns nil
func (DefaultFileRepository) GetForHour ¶
func (fr DefaultFileRepository) GetForHour(hour string) *domain.FileList
GetForHour returns all files' information that fall into a given start hour. If no files match, the methods returns nil
func (DefaultFileRepository) LoadFromDisk ¶
func (fr DefaultFileRepository) LoadFromDisk(fileName string) error
LoadFromDisk loads file information stored on disk into memory
func (DefaultFileRepository) NewFiles ¶
func (fr DefaultFileRepository) NewFiles() (newFiles bool)
NewFiles returns true, if there are file entries in the repository for which additional information hasn't been extracted
func (DefaultFileRepository) SaveToDisk ¶
func (fr DefaultFileRepository) SaveToDisk(fileName string) error
SaveToDisk writes the repository's contents to a specified file on disk
func (DefaultFileRepository) Size ¶
func (fr DefaultFileRepository) Size() int
Size returns the number of files stored in the repository
func (DefaultFileRepository) Store ¶
func (fr DefaultFileRepository) Store(fi domain.FileInfo) error
Store stores a new file information entry into the repository
func (DefaultFileRepository) StreamSize ¶
func (fr DefaultFileRepository) StreamSize() int
StreamSize returns the number of stream files (as identified by their file extension) stored in the repository
type FileRepository ¶
type FileRepository interface { Exists(string) bool Size() int AudioSize() int StreamSize() int GetByPath(string) *domain.FileInfo GetByEventId(int) *domain.FileList GetAll() *domain.FileList GetForHour(string) *domain.FileList Store(domain.FileInfo) error Delete(string) error SaveToDisk(string) error LoadFromDisk(string) error DeleteAllData() NewFiles() bool }