participant.go 932 B

1234567891011121314151617181920212223242526
  1. package file
  2. import (
  3. "git.andreafazzi.eu/andrea/probo/lib/models"
  4. "git.andreafazzi.eu/andrea/probo/lib/store"
  5. )
  6. type ParticipantFileStore = FileStore[*models.Participant, *store.ParticipantStore]
  7. func NewParticipantFileStore(config *FileStoreConfig[*models.Participant, *store.ParticipantStore]) (*ParticipantFileStore, error) {
  8. return NewFileStore[*models.Participant, *store.ParticipantStore](config, store.NewParticipantStore())
  9. }
  10. func NewParticipantDefaultFileStore() (*ParticipantFileStore, error) {
  11. return NewParticipantFileStore(
  12. &FileStoreConfig[*models.Participant, *store.ParticipantStore]{
  13. FilePathConfig: FilePathConfig{GetDefaultParticipantsDir(), "participant", ".json"},
  14. IndexDirFunc: DefaultIndexDirFunc[*models.Participant, *store.ParticipantStore],
  15. CreateEntityFunc: func() *models.Participant {
  16. return &models.Participant{
  17. Attributes: make(map[string]string),
  18. }
  19. },
  20. },
  21. )
  22. }