Add list to store

This commit is contained in:
Torjus Håkestad 2022-04-20 22:51:06 +02:00
parent 54ff777532
commit a0c06e5615
2 changed files with 12 additions and 0 deletions

View File

@ -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
}

View File

@ -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)
}