probo/lib/store/file/participant.go

27 lines
932 B
Go
Raw Normal View History

package file
import (
2023-12-21 17:38:05 +01:00
"git.andreafazzi.eu/andrea/probo/lib/models"
"git.andreafazzi.eu/andrea/probo/lib/store"
)
2023-11-21 15:12:13 +01:00
type ParticipantFileStore = FileStore[*models.Participant, *store.ParticipantStore]
2023-11-21 15:12:13 +01:00
func NewParticipantFileStore(config *FileStoreConfig[*models.Participant, *store.ParticipantStore]) (*ParticipantFileStore, error) {
return NewFileStore[*models.Participant, *store.ParticipantStore](config, store.NewParticipantStore())
}
func NewParticipantDefaultFileStore() (*ParticipantFileStore, error) {
return NewParticipantFileStore(
&FileStoreConfig[*models.Participant, *store.ParticipantStore]{
FilePathConfig: FilePathConfig{GetDefaultParticipantsDir(), "participant", ".json"},
IndexDirFunc: DefaultIndexDirFunc[*models.Participant, *store.ParticipantStore],
2023-11-21 18:24:10 +01:00
CreateEntityFunc: func() *models.Participant {
return &models.Participant{
Attributes: make(map[string]string),
}
},
2023-11-21 15:12:13 +01:00
},
)
}