mirror of
https://github.com/gofiber/storage.git
synced 2025-10-05 00:33:03 +08:00
✏ return nil for notfound
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user