Skip to content

Commit

Permalink
fix: use constants instead of iota to prevent forward compatibility. (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
bigboss2063 committed Nov 21, 2023
1 parent bc3393e commit c1b21f5
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 23 deletions.
38 changes: 19 additions & 19 deletions db.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,61 +36,61 @@ import (

const (
// DataDeleteFlag represents the data delete flag
DataDeleteFlag uint16 = iota
DataDeleteFlag = 0

// DataSetFlag represents the data set flag
DataSetFlag
DataSetFlag = 1

// DataLPushFlag represents the data LPush flag
DataLPushFlag
DataLPushFlag = 2

// DataRPushFlag represents the data RPush flag
DataRPushFlag
DataRPushFlag = 3

// DataLRemFlag represents the data LRem flag
DataLRemFlag
DataLRemFlag = 4

// DataLPopFlag represents the data LPop flag
DataLPopFlag
DataLPopFlag = 5

// DataRPopFlag represents the data RPop flag
DataRPopFlag
DataRPopFlag = 6

// DataLTrimFlag represents the data LTrim flag
DataLTrimFlag
DataLTrimFlag = 8

// DataZAddFlag represents the data ZAdd flag
DataZAddFlag
DataZAddFlag = 9

// DataZRemFlag represents the data ZRem flag
DataZRemFlag
DataZRemFlag = 10

// DataZRemRangeByRankFlag represents the data ZRemRangeByRank flag
DataZRemRangeByRankFlag
DataZRemRangeByRankFlag = 11

// DataZPopMaxFlag represents the data ZPopMax flag
DataZPopMaxFlag
DataZPopMaxFlag = 12

// DataZPopMinFlag represents the data aZPopMin flag
DataZPopMinFlag
DataZPopMinFlag = 13

// DataSetBucketDeleteFlag represents the delete Set bucket flag
DataSetBucketDeleteFlag
DataSetBucketDeleteFlag = 14

// DataSortedSetBucketDeleteFlag represents the delete Sorted Set bucket flag
DataSortedSetBucketDeleteFlag
DataSortedSetBucketDeleteFlag = 15

// DataBTreeBucketDeleteFlag represents the delete BTree bucket flag
DataBTreeBucketDeleteFlag
DataBTreeBucketDeleteFlag = 16

// DataListBucketDeleteFlag represents the delete List bucket flag
DataListBucketDeleteFlag
DataListBucketDeleteFlag = 17

// DataLRemByIndex represents the data LRemByIndex flag
DataLRemByIndex
DataLRemByIndex = 18

// DataExpireListFlag represents that set ttl for the list
DataExpireListFlag
DataExpireListFlag = 19
)

const (
Expand Down
2 changes: 1 addition & 1 deletion tx_bucket.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ package nutsdb
import "time"

// IterateBuckets iterate over all the bucket depends on ds (represents the data structure)
func (tx *Tx) IterateBuckets(ds uint16, pattern string, f func(key string) bool) error {
func (tx *Tx) IterateBuckets(ds uint16, pattern string, f func(bucket string) bool) error {
if err := tx.checkTxIsClosed(); err != nil {
return err
}
Expand Down
6 changes: 3 additions & 3 deletions utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,12 @@ func UnmarshalInts(data []byte) ([]int, error) {
return ints, nil
}

func MatchForRange(pattern, key string, f func(key string) bool) (end bool, err error) {
match, err := filepath.Match(pattern, key)
func MatchForRange(pattern, bucket string, f func(bucket string) bool) (end bool, err error) {
match, err := filepath.Match(pattern, bucket)
if err != nil {
return true, err
}
if match && !f(key) {
if match && !f(bucket) {
return true, nil
}
return false, nil
Expand Down

0 comments on commit c1b21f5

Please sign in to comment.