probo/store/file/group.go

27 lines
808 B
Go

package file
import (
"git.andreafazzi.eu/andrea/probo/models"
"git.andreafazzi.eu/andrea/probo/store"
)
type GroupFileStore = FileStore[*models.Group, *store.Store[*models.Group]]
func NewGroupFileStore(config *FileStoreConfig[*models.Group, *store.GroupStore]) (*GroupFileStore, error) {
return NewFileStore[*models.Group](config, store.NewStore[*models.Group]())
}
func NewDefaultGroupFileStore() (*GroupFileStore, error) {
return NewGroupFileStore(
&FileStoreConfig[*models.Group, *store.GroupStore]{
FilePathConfig: FilePathConfig{GetDefaultGroupsDir(), "group", ".csv"},
IndexDirFunc: DefaultIndexDirFunc[*models.Group, *store.GroupStore],
CreateEntityFunc: func() *models.Group {
return &models.Group{
Participants: make([]*models.Participant, 0),
}
},
},
)
}