2023-11-05 14:36:33 +01:00
|
|
|
package file
|
|
|
|
|
|
|
|
import (
|
|
|
|
"git.andreafazzi.eu/andrea/probo/models"
|
2023-11-13 21:01:12 +01:00
|
|
|
"git.andreafazzi.eu/andrea/probo/store"
|
2023-11-05 14:36:33 +01:00
|
|
|
)
|
|
|
|
|
2023-11-18 11:12:07 +01:00
|
|
|
type CollectionFileStore = FileStore[*models.Collection, *store.Store[*models.Collection]]
|
|
|
|
|
|
|
|
func NewCollectionFileStore(config *FileStoreConfig[*models.Collection, *store.CollectionStore]) (*CollectionFileStore, error) {
|
|
|
|
return NewFileStore[*models.Collection](config, store.NewStore[*models.Collection]())
|
|
|
|
}
|
|
|
|
|
2023-11-20 14:14:09 +01:00
|
|
|
func NewDefaultCollectionFileStore() (*CollectionFileStore, error) {
|
|
|
|
return NewCollectionFileStore(
|
|
|
|
&FileStoreConfig[*models.Collection, *store.CollectionStore]{
|
2023-11-21 15:12:13 +01:00
|
|
|
FilePathConfig: FilePathConfig{GetDefaultCollectionsDir(), "collection", ".json"},
|
2023-11-20 14:14:09 +01:00
|
|
|
IndexDirFunc: DefaultIndexDirFunc[*models.Collection, *store.CollectionStore],
|
|
|
|
},
|
|
|
|
)
|
2023-11-18 11:12:07 +01:00
|
|
|
|
2023-11-05 14:36:33 +01:00
|
|
|
}
|