-
Notifications
You must be signed in to change notification settings - Fork 11
/
helpers.go
283 lines (227 loc) · 6.02 KB
/
helpers.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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
package nan
import "time"
// StringToNullString - converts string to NullString
//
// Deprecated: use shorter variant
func StringToNullString(v string) NullString {
return NullString{String: v, Valid: true}
}
// BoolToNullBool - converts bool to NullBool
//
// Deprecated: use shorter variant
func BoolToNullBool(v bool) NullBool {
return NullBool{Bool: v, Valid: true}
}
// Int64ToNullInt64 - converts int64 to NullInt64
//
// Deprecated: use shorter variant
func Int64ToNullInt64(v int64) NullInt64 {
return NullInt64{Int64: v, Valid: true}
}
// TimeToNullTime - converts time.Time to NullTime
//
// Deprecated: use shorter variant
func TimeToNullTime(v time.Time) NullTime {
return NullTime{Time: v, Valid: true}
}
// Float64ToNullFloat64 - converts float64 to NullFloat64
//
// Deprecated: use shorter variant
func Float64ToNullFloat64(v float64) NullFloat64 {
return NullFloat64{Float64: v, Valid: true}
}
// Float32ToNullFloat32 - converts float32 to NullFloat32
//
// Deprecated: use shorter variant
func Float32ToNullFloat32(v float32) NullFloat32 {
return NullFloat32{Float32: v, Valid: true}
}
// Int8ToNullInt8 - converts int8 to NullInt8
//
// Deprecated: use shorter variant
func Int8ToNullInt8(v int8) NullInt8 {
return NullInt8{Int8: v, Valid: true}
}
// Int16ToNullInt16 - converts int16 to NullInt16
//
// Deprecated: use shorter variant
func Int16ToNullInt16(v int16) NullInt16 {
return NullInt16{Int16: v, Valid: true}
}
// Int32ToNullInt32 - converts int32 to NullInt32
//
// Deprecated: use shorter variant
func Int32ToNullInt32(v int32) NullInt32 {
return NullInt32{Int32: v, Valid: true}
}
// IntToNullInt - converts int to NullInt
//
// Deprecated: use shorter variant
func IntToNullInt(v int) NullInt {
return NullInt{Int: v, Valid: true}
}
// String - converts string to NullString
func String(v string) NullString {
return NullString{String: v, Valid: true}
}
// Bool - converts bool to NullBool
func Bool(v bool) NullBool {
return NullBool{Bool: v, Valid: true}
}
// Int64 - converts int64 to NullInt64
func Int64(v int64) NullInt64 {
return NullInt64{Int64: v, Valid: true}
}
// Time - converts time.Time to NullTime
func Time(v time.Time) NullTime {
return NullTime{Time: v, Valid: true}
}
// Float64 - converts float64 to NullFloat64
func Float64(v float64) NullFloat64 {
return NullFloat64{Float64: v, Valid: true}
}
// Float32 - converts float32 to NullFloat32
func Float32(v float32) NullFloat32 {
return NullFloat32{Float32: v, Valid: true}
}
// Int8 - converts int8 to NullInt8
func Int8(v int8) NullInt8 {
return NullInt8{Int8: v, Valid: true}
}
// Int16 - converts int16 to NullInt16
func Int16(v int16) NullInt16 {
return NullInt16{Int16: v, Valid: true}
}
// Int32 - converts int32 to NullInt32
func Int32(v int32) NullInt32 {
return NullInt32{Int32: v, Valid: true}
}
// Int - converts int to NullInt
func Int(v int) NullInt {
return NullInt{Int: v, Valid: true}
}
// Uint - converts uint to NullUint
func Uint(v uint) NullUint {
return NullUint{Uint: v, Valid: true}
}
// Uint8 - converts uint8 to NullUint8
func Uint8(v uint8) NullUint8 {
return NullUint8{Uint8: v, Valid: true}
}
// Uint16 - converts uint16 to NullUint16
func Uint16(v uint16) NullUint16 {
return NullUint16{Uint16: v, Valid: true}
}
// Uint32 - converts uint32 to NullUint32
func Uint32(v uint32) NullUint32 {
return NullUint32{Uint32: v, Valid: true}
}
// Uint64 - converts uint64 to NullUint64
func Uint64(v uint64) NullUint64 {
return NullUint64{Uint64: v, Valid: true}
}
// StringAddr - converts string address to NullString
func StringAddr(v *string) NullString {
if v == nil {
return NullString{}
}
return NullString{String: *v, Valid: true}
}
// BoolAddr - converts bool address to NullBool
func BoolAddr(v *bool) NullBool {
if v == nil {
return NullBool{}
}
return NullBool{Bool: *v, Valid: true}
}
// Int64Addr - converts int64 address to NullInt64
func Int64Addr(v *int64) NullInt64 {
if v == nil {
return NullInt64{}
}
return NullInt64{Int64: *v, Valid: true}
}
// TimeAddr - converts time.Time address to NullTime
func TimeAddr(v *time.Time) NullTime {
if v == nil {
return NullTime{}
}
return NullTime{Time: *v, Valid: true}
}
// Float64Addr - converts float64 address to NullFloat64
func Float64Addr(v *float64) NullFloat64 {
if v == nil {
return NullFloat64{}
}
return NullFloat64{Float64: *v, Valid: true}
}
// Float32Addr - converts float32 address to NullFloat32
func Float32Addr(v *float32) NullFloat32 {
if v == nil {
return NullFloat32{}
}
return NullFloat32{Float32: *v, Valid: true}
}
// Int8Addr - converts int8 address to NullInt8
func Int8Addr(v *int8) NullInt8 {
if v == nil {
return NullInt8{}
}
return NullInt8{Int8: *v, Valid: true}
}
// Int16Addr - converts int16 address to NullInt16
func Int16Addr(v *int16) NullInt16 {
if v == nil {
return NullInt16{}
}
return NullInt16{Int16: *v, Valid: true}
}
// Int32Addr - converts int32 address to NullInt32
func Int32Addr(v *int32) NullInt32 {
if v == nil {
return NullInt32{}
}
return NullInt32{Int32: *v, Valid: true}
}
// IntAddr - converts int address to NullInt
func IntAddr(v *int) NullInt {
if v == nil {
return NullInt{}
}
return NullInt{Int: *v, Valid: true}
}
// UintAddr - converts uint address to NullUint
func UintAddr(v *uint) NullUint {
if v == nil {
return NullUint{}
}
return NullUint{Uint: *v, Valid: true}
}
// Uint8Addr - converts uint8 address to NullUint8
func Uint8Addr(v *uint8) NullUint8 {
if v == nil {
return NullUint8{}
}
return NullUint8{Uint8: *v, Valid: true}
}
// Uint16Addr - converts uint16 address to NullUint16
func Uint16Addr(v *uint16) NullUint16 {
if v == nil {
return NullUint16{}
}
return NullUint16{Uint16: *v, Valid: true}
}
// Uint32Addr - converts uint32 address to NullUint32
func Uint32Addr(v *uint32) NullUint32 {
if v == nil {
return NullUint32{}
}
return NullUint32{Uint32: *v, Valid: true}
}
// Uint64Addr - converts uint64 address to NullUint64
func Uint64Addr(v *uint64) NullUint64 {
if v == nil {
return NullUint64{}
}
return NullUint64{Uint64: *v, Valid: true}
}