probo/pkg/store/file/response.go

25 lines
821 B
Go

package file
import (
"git.andreafazzi.eu/andrea/probo/pkg/models"
"git.andreafazzi.eu/andrea/probo/pkg/store"
)
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{}
},
},
)
}