forked from nutsdb/nutsdb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
errors.go
40 lines (32 loc) · 1.02 KB
/
errors.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package nutsdb
import (
"errors"
)
// IsDBClosed is true if the error indicates the db was closed.
func IsDBClosed(err error) bool {
return errors.Is(err, ErrDBClosed)
}
// IsKeyNotFound is true if the error indicates the key is not found.
func IsKeyNotFound(err error) bool {
return errors.Is(err, ErrKeyNotFound)
}
// IsBucketNotFound is true if the error indicates the bucket is not exists.
func IsBucketNotFound(err error) bool {
return errors.Is(err, ErrBucketNotFound)
}
// IsBucketEmpty is true if the bucket is empty.
func IsBucketEmpty(err error) bool {
return errors.Is(err, ErrBucketEmpty)
}
// IsKeyEmpty is true if the key is empty.
func IsKeyEmpty(err error) bool {
return errors.Is(err, ErrKeyEmpty)
}
// IsPrefixScan is true if prefix scanning not found the result.
func IsPrefixScan(err error) bool {
return errors.Is(err, ErrPrefixScan)
}
// IsPrefixSearchScan is true if prefix and search scanning not found the result.
func IsPrefixSearchScan(err error) bool {
return errors.Is(err, ErrPrefixSearchScan)
}