-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathconst.go
88 lines (78 loc) · 2.2 KB
/
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
package dsmock
type TypeStyle string
const (
KeywordKey = "__key__"
KeywordCurrent = "__current__"
KeywordNoIndex = "__noindex__"
KeywordNoIndexValue = "noindex"
KeywordString = "__string__"
KeywordDatetime = "__datetime__"
KeywordInteger = "__integer__"
KeywordInt = "__int__"
KeywordFloat = "__float__"
KeywordBoolean = "__boolean__"
KeywordBool = "__bool__"
KeywordGeo = "__geo__"
KeywordArray = "__array__"
KeywordEmbed = "__embed__"
KeywordBlob = "__blob__"
KeywordNull = "__null__"
)
type DatastoreType string
const (
TypeString = DatastoreType("string")
TypeDatetime = DatastoreType("datetime")
TypeInteger = DatastoreType("integer")
TypeInt = DatastoreType("int")
TypeFloat = DatastoreType("float")
TypeBoolean = DatastoreType("boolean")
TypeBool = DatastoreType("bool")
TypeKey = DatastoreType("key")
TypeGeo = DatastoreType("geo")
TypeArray = DatastoreType("array")
TypeEmbed = DatastoreType("embed")
TypeBlob = DatastoreType("blob")
TypeNull = DatastoreType("null")
TypeNil = DatastoreType("<nil>")
)
var (
keywordTypeMap = map[string]DatastoreType{
KeywordString: TypeString,
KeywordDatetime: TypeDatetime,
KeywordInteger: TypeInteger,
KeywordInt: TypeInt,
KeywordFloat: TypeFloat,
KeywordBoolean: TypeBoolean,
KeywordBool: TypeBool,
KeywordKey: TypeKey,
KeywordGeo: TypeGeo,
KeywordArray: TypeArray,
KeywordEmbed: TypeEmbed,
KeywordBlob: TypeBlob,
KeywordNull: TypeNull,
}
typeKeywordMap = map[DatastoreType]string{
TypeString: KeywordString,
TypeDatetime: KeywordDatetime,
TypeInteger: KeywordInteger,
TypeInt: KeywordInt,
TypeFloat: KeywordFloat,
TypeBoolean: KeywordBoolean,
TypeBool: KeywordBool,
TypeKey: KeywordKey,
TypeGeo: KeywordGeo,
TypeArray: KeywordArray,
TypeEmbed: KeywordEmbed,
TypeBlob: KeywordBlob,
TypeNull: KeywordNull,
}
)
func IsKeyValueName(name string) bool {
return name == KeywordKey
}
func IsCurrentDatetime(name string) bool {
return name == KeywordCurrent
}
func IsNoIndex(value string) bool {
return value == KeywordNoIndexValue
}