2023-12-11 09:32:50 +01:00
|
|
|
package file
|
|
|
|
|
|
|
|
import (
|
2024-02-06 09:03:57 +01:00
|
|
|
"git.andreafazzi.eu/andrea/probo/pkg/models"
|
|
|
|
"git.andreafazzi.eu/andrea/probo/pkg/store"
|
2023-12-11 09:32:50 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
type ResponseFileStore = FileStore[*models.Response, *store.Store[*models.Response]]
|
|
|
|
|
|
|
|
func NewResponseFileStore(config *FileStoreConfig[*models.Response, *store.ResponseStore]) (*ResponseFileStore, error) {
|
|
|
|
return NewFileStore[*models.Response](config, store.NewStore[*models.Response]())
|
|
|
|
}
|
|
|
|
|
|
|
|
func NewDefaultResponseFileStore() (*ResponseFileStore, error) {
|
|
|
|
return NewResponseFileStore(
|
|
|
|
&FileStoreConfig[*models.Response, *store.ResponseStore]{
|
|
|
|
FilePathConfig: FilePathConfig{GetDefaultResponsesDir(), "response", ".json"},
|
|
|
|
IndexDirFunc: DefaultIndexDirFunc[*models.Response, *store.ResponseStore],
|
|
|
|
CreateEntityFunc: func() *models.Response {
|
|
|
|
return &models.Response{}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
)
|
|
|
|
|
|
|
|
}
|