✏ return nil for notfound

This commit is contained in:
Fenny
2020-11-23 09:30:50 +01:00
parent fd56bd28da
commit ab94351a60
35 changed files with 109 additions and 134 deletions

View File

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