mirror of https://github.com/ledisdb/ledisdb.git
don't export some error
This commit is contained in:
parent
f702354738
commit
51349ea12a
|
@ -28,6 +28,14 @@ const (
|
|||
defaultScanCount int = 10
|
||||
)
|
||||
|
||||
var (
|
||||
errKeySize = errors.New("invalid key size")
|
||||
errValueSize = errors.New("invalid value size")
|
||||
errHashFieldSize = errors.New("invalid hash field size")
|
||||
errZSetMemberSize = errors.New("invalid zset member size")
|
||||
errExpireValue = errors.New("invalid expire value")
|
||||
)
|
||||
|
||||
const (
|
||||
//we don't support too many databases
|
||||
MaxDBNumber uint8 = 16
|
||||
|
@ -46,12 +54,7 @@ const (
|
|||
)
|
||||
|
||||
var (
|
||||
ErrKeySize = errors.New("invalid key size")
|
||||
ErrValueSize = errors.New("invalid value size")
|
||||
ErrHashFieldSize = errors.New("invalid hash field size")
|
||||
ErrZSetMemberSize = errors.New("invalid zset member size")
|
||||
ErrExpireValue = errors.New("invalid expire value")
|
||||
ErrScoreMiss = errors.New("zset score miss")
|
||||
ErrScoreMiss = errors.New("zset score miss")
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -130,3 +130,7 @@ func (l *Ledis) RepliateRelayLog(relayLog string, offset int64) (int64, error) {
|
|||
log.Error("can not go here")
|
||||
return offset, nil
|
||||
}
|
||||
|
||||
func (l *Ledis) WriteRelayLog(data []byte) error {
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -21,9 +21,9 @@ const (
|
|||
|
||||
func checkHashKFSize(key []byte, field []byte) error {
|
||||
if len(key) > MaxKeySize || len(key) == 0 {
|
||||
return ErrKeySize
|
||||
return errKeySize
|
||||
} else if len(field) > MaxHashFieldSize || len(field) == 0 {
|
||||
return ErrHashFieldSize
|
||||
return errHashFieldSize
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -15,14 +15,14 @@ var errKVKey = errors.New("invalid encode kv key")
|
|||
|
||||
func checkKeySize(key []byte) error {
|
||||
if len(key) > MaxKeySize || len(key) == 0 {
|
||||
return ErrKeySize
|
||||
return errKeySize
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func checkValueSize(value []byte) error {
|
||||
if len(value) > MaxValueSize {
|
||||
return ErrValueSize
|
||||
return errValueSize
|
||||
}
|
||||
|
||||
return nil
|
||||
|
@ -360,7 +360,7 @@ func (db *DB) Scan(key []byte, count int, inclusive bool) ([]KVPair, error) {
|
|||
|
||||
func (db *DB) Expire(key []byte, duration int64) (int64, error) {
|
||||
if duration <= 0 {
|
||||
return 0, ErrExpireValue
|
||||
return 0, errExpireValue
|
||||
}
|
||||
|
||||
t := db.kvTx
|
||||
|
@ -381,7 +381,7 @@ func (db *DB) Expire(key []byte, duration int64) (int64, error) {
|
|||
|
||||
func (db *DB) ExpireAt(key []byte, when int64) (int64, error) {
|
||||
if when <= time.Now().Unix() {
|
||||
return 0, ErrExpireValue
|
||||
return 0, errExpireValue
|
||||
}
|
||||
|
||||
t := db.kvTx
|
||||
|
|
|
@ -34,9 +34,9 @@ const (
|
|||
|
||||
func checkZSetKMSize(key []byte, member []byte) error {
|
||||
if len(key) > MaxKeySize || len(key) == 0 {
|
||||
return ErrKeySize
|
||||
return errKeySize
|
||||
} else if len(member) > MaxZSetMemberSize || len(member) == 0 {
|
||||
return ErrZSetMemberSize
|
||||
return errZSetMemberSize
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
@ -484,7 +484,7 @@ func (db *DB) zIterator(key []byte, min int64, max int64, offset int, limit int,
|
|||
|
||||
func (db *DB) zRemRange(key []byte, min int64, max int64, offset int, limit int) (int64, error) {
|
||||
if len(key) > MaxKeySize {
|
||||
return 0, ErrKeySize
|
||||
return 0, errKeySize
|
||||
}
|
||||
|
||||
t := db.zsetTx
|
||||
|
@ -537,7 +537,7 @@ func (db *DB) zReverse(s []interface{}, withScores bool) []interface{} {
|
|||
|
||||
func (db *DB) zRange(key []byte, min int64, max int64, withScores bool, offset int, limit int, reverse bool) ([]interface{}, error) {
|
||||
if len(key) > MaxKeySize {
|
||||
return nil, ErrKeySize
|
||||
return nil, errKeySize
|
||||
}
|
||||
|
||||
if offset < 0 {
|
||||
|
|
Loading…
Reference in New Issue