-
Notifications
You must be signed in to change notification settings - Fork 4
/
const.go
43 lines (37 loc) · 963 Bytes
/
const.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
41
42
43
package main
import (
"github.com/dustin/go-humanize"
"github.com/redis/go-redis/v9"
"github.com/xgzlucario/rotom/internal/hash"
"github.com/xgzlucario/rotom/internal/iface"
"github.com/xgzlucario/rotom/internal/list"
"github.com/xgzlucario/rotom/internal/zset"
)
type ObjectType byte
const (
TypeUnknown ObjectType = iota
TypeString
TypeInteger
TypeMap
TypeSet
TypeZipSet
TypeList
TypeZSet
TypeZipZSet
)
const (
KeepTTL int64 = redis.KeepTTL
KeyNotExist int64 = -2
)
const (
KB = humanize.Byte
MB = humanize.MiByte
)
var type2c = map[ObjectType]func() iface.Encoder{
TypeMap: func() iface.Encoder { return hash.New() },
TypeSet: func() iface.Encoder { return hash.NewSet() },
TypeZipSet: func() iface.Encoder { return hash.NewZipSet() },
TypeList: func() iface.Encoder { return list.New() },
TypeZSet: func() iface.Encoder { return zset.New() },
TypeZipZSet: func() iface.Encoder { return zset.NewZipZSet() },
}