Add list to store
This commit is contained in:
parent
54ff777532
commit
a0c06e5615
@ -8,6 +8,8 @@ import (
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
var _ Store = &MemoryStore{}
|
||||
|
||||
type MemoryStore struct {
|
||||
data map[string][]byte
|
||||
}
|
||||
@ -44,3 +46,12 @@ func (s *MemoryStore) Get(id string) (io.ReadCloser, error) {
|
||||
|
||||
return r, nil
|
||||
}
|
||||
|
||||
func (s *MemoryStore) List() ([]string, error) {
|
||||
var ids []string
|
||||
for id := range s.data {
|
||||
ids = append(ids, id)
|
||||
}
|
||||
|
||||
return ids, nil
|
||||
}
|
||||
|
@ -11,4 +11,5 @@ type Store interface {
|
||||
Add(r io.Reader) (string, error)
|
||||
Delete(id string) error
|
||||
Get(id string) (io.ReadCloser, error)
|
||||
List() ([]string, error)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user