-
Notifications
You must be signed in to change notification settings - Fork 4
/
const.go
44 lines (38 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
44
package main
import (
"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 = redis.KeepTTL
KEY_NOT_EXIST = -2
)
const (
KB = 1024
MB = 1024 * KB
GB = 1024 * MB
)
// type2c is objectType to new encoder.
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() },
}