-
Notifications
You must be signed in to change notification settings - Fork 0
/
xhash.go
169 lines (129 loc) · 4.18 KB
/
xhash.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
package xhash
import (
"time"
)
type THashMap map[string]interface{}
func New(mp ...map[string]interface{}) THashMap {
var def map[string]interface{}
if len(mp) > 0 {
def = mp[0]
} else {
def = make(map[string]interface{})
}
return THashMap(def)
}
func (mp THashMap) Map() map[string]interface{} {
return mp
}
func (mp THashMap) ToArray() [][]interface{} {
result := make([][]interface{}, 0)
for k, v := range mp {
result = append(result, []interface{}{k, v})
}
return result
}
func (mp THashMap) GetString(key string, def ...string) string {
return GetString(mp, key, def...)
}
func (mp THashMap) GetInt(key string, def ...int) int {
return GetInt(mp, key, def...)
}
func (mp THashMap) GetInt8(key string, def ...int8) int8 {
return GetInt8(mp, key, def...)
}
func (mp THashMap) GetInt16(key string, def ...int16) int16 {
return GetInt16(mp, key, def...)
}
func (mp THashMap) GetInt32(key string, def ...int32) int32 {
return GetInt32(mp, key, def...)
}
func (mp THashMap) GetInt64(key string, def ...int64) int64 {
return GetInt64(mp, key, def...)
}
func (mp THashMap) GetUint(key string, def ...uint) uint {
return GetUint(mp, key, def...)
}
func (mp THashMap) GetUint8(key string, def ...uint8) uint8 {
return GetUint8(mp, key, def...)
}
func (mp THashMap) GetUint16(key string, def ...uint16) uint16 {
return GetUint16(mp, key, def...)
}
func (mp THashMap) GetUint32(key string, def ...uint32) uint32 {
return GetUint32(mp, key, def...)
}
func (mp THashMap) GetUint64(key string, def ...uint64) uint64 {
return GetUint64(mp, key, def...)
}
func (mp THashMap) GetFloat32(key string, def ...float32) float32 {
return GetFloat32(mp, key, def...)
}
func (mp THashMap) GetFloat64(key string, def ...float64) float64 {
return GetFloat64(mp, key, def...)
}
func (mp THashMap) GetBool(key string, def ...bool) bool {
return GetBool(mp, key, def...)
}
func (mp THashMap) GetInterface(key string, def ...interface{}) interface{} {
return GetInterface(mp, key, def...)
}
func (mp THashMap) GetMap(key string, def ...map[string]interface{}) interface{} {
return GetMap(mp, key, def...)
}
func (mp THashMap) GetArray(key string, def ...[]interface{}) []interface{} {
return GetArray(mp, key, def...)
}
func (mp THashMap) GetTime(key string, def ...time.Time) time.Time {
return GetTime(mp, key, def...)
}
func (mp THashMap) GetPathInterface(path string, def ...interface{}) interface{} {
return GetPathInterface(mp, path, def...)
}
func (mp THashMap) GetPathString(path string, def ...string) string {
return GetPathString(mp, path, def...)
}
func (mp THashMap) GetPathInt(path string, def ...int) int {
return GetPathInt(mp, path, def...)
}
func (mp THashMap) GetPathInt8(path string, def ...int8) int8 {
return GetPathInt8(mp, path, def...)
}
func (mp THashMap) GetPathInt16(path string, def ...int16) int16 {
return GetPathInt16(mp, path, def...)
}
func (mp THashMap) GetPathInt32(path string, def ...int32) int32 {
return GetPathInt32(mp, path, def...)
}
func (mp THashMap) GetPathInt64(path string, def ...int64) int64 {
return GetPathInt64(mp, path, def...)
}
func (mp THashMap) GetPathUint(path string, def ...uint) uint {
return GetPathUint(mp, path, def...)
}
func (mp THashMap) GetPathUint8(path string, def ...uint8) uint8 {
return GetPathUint8(mp, path, def...)
}
func (mp THashMap) GetPathUint16(path string, def ...uint16) uint16 {
return GetPathUint16(mp, path, def...)
}
func (mp THashMap) GetPathUint32(path string, def ...uint32) uint32 {
return GetPathUint32(mp, path, def...)
}
func (mp THashMap) GetPathUint64(path string, def ...uint64) uint64 {
return GetPathUint64(mp, path, def...)
}
func (mp THashMap) GetPathFloat(path string, def ...float32) float32 {
return GetPathFloat(mp, path, def...)
}
func (mp THashMap) GetPathFloat64(path string, def ...float64) float64 {
return GetPathFloat64(mp, path, def...)
}
func (mp THashMap) GetPathBool(path string, def ...bool) bool {
return GetPathBool(mp, path, def...)
}
func (mp THashMap) GetPathMap(path string, def ...map[string]interface{}) map[string]interface{} {
return GetPathMap(mp, path, def...)
}
func (mp THashMap) GetPathArray(path string, def ...[]interface{}) []interface{} {
return GetPathArray(mp, path, def...)
}