✏ update comments

This commit is contained in:
Fenny
2020-11-17 13:56:09 +01:00
parent deb10fb2a7
commit ddef41c2ee
28 changed files with 173 additions and 99 deletions

View File

@@ -14,7 +14,8 @@
```go
func New(config Config) Storage
var ErrNotExist = errors.New("key does not exist")
// ErrNotFound means that a get call did not find the requested key.
var ErrNotFound = errors.New("key not found")
func (s *Storage) Get(key string) ([]byte, error)
func (s *Storage) Set(key string, val []byte, exp time.Duration) error

View File

@@ -18,8 +18,9 @@ type Storage struct {
table string
}
// Common storage errors
var ErrNotExist = errors.New("key does not exist")
// ErrNotFound means that a get call did not find the requested key.
var ErrNotFound = errors.New("key not found")
// New creates a new storage
func New(config Config) *Storage {
@@ -112,11 +113,11 @@ func (s *Storage) Get(key string) ([]byte, error) {
if err != nil {
return nil, err
} else if getItemOutput.Item == nil {
return nil, ErrNotExist
return nil, ErrNotFound
}
attributeVal := getItemOutput.Item[valAttrName]
if attributeVal == nil {
return nil, ErrNotExist
return nil, ErrNotFound
}
return attributeVal.B, nil
}