github.com/nutsdb/nutsdb@v1.0.4/errors.go (about) 1 package nutsdb 2 3 import ( 4 "errors" 5 ) 6 7 // IsDBClosed is true if the error indicates the db was closed. 8 func IsDBClosed(err error) bool { 9 return errors.Is(err, ErrDBClosed) 10 } 11 12 // IsKeyNotFound is true if the error indicates the key is not found. 13 func IsKeyNotFound(err error) bool { 14 return errors.Is(err, ErrKeyNotFound) 15 } 16 17 // IsBucketNotFound is true if the error indicates the bucket is not exists. 18 func IsBucketNotFound(err error) bool { 19 return errors.Is(err, ErrBucketNotFound) 20 } 21 22 // IsBucketEmpty is true if the bucket is empty. 23 func IsBucketEmpty(err error) bool { 24 return errors.Is(err, ErrBucketEmpty) 25 } 26 27 // IsKeyEmpty is true if the key is empty. 28 func IsKeyEmpty(err error) bool { 29 return errors.Is(err, ErrKeyEmpty) 30 } 31 32 // IsPrefixScan is true if prefix scanning not found the result. 33 func IsPrefixScan(err error) bool { 34 return errors.Is(err, ErrPrefixScan) 35 } 36 37 // IsPrefixSearchScan is true if prefix and search scanning not found the result. 38 func IsPrefixSearchScan(err error) bool { 39 return errors.Is(err, ErrPrefixSearchScan) 40 }