-
Notifications
You must be signed in to change notification settings - Fork 0
/
int.go
66 lines (56 loc) · 1.14 KB
/
int.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
package converttype
//Int convert int value to int pointer
func Int(val int) *int {
return &val
}
//Int8 convert int8 value to int8 pointer
func Int8(val int8) *int8 {
return &val
}
//Int16 convert int16 value to int16 pointer
func Int16(val int16) *int16 {
return &val
}
//Int32 convert int32 value to int32 pointer
func Int32(val int32) *int32 {
return &val
}
//Int64 convert int64 value to int64 pointer
func Int64(val int64) *int64 {
return &val
}
//Int return value of int pointer or 0 if pointer is nil
func IntValue(val *int) int {
if val != nil {
return *val
}
return 0
}
//Int8 return value of int8 pointer or 0 if pointer is nil
func Int8Value(val *int8) int8 {
if val != nil {
return *val
}
return 0
}
//Int16 return value of int16 pointer or 0 if pointer is nil
func Int16Value(val *int16) int16 {
if val != nil {
return *val
}
return 0
}
//Int32 return value of int32 pointer or 0 if pointer is nil
func Int32Value(val *int32) int32 {
if val != nil {
return *val
}
return 0
}
//Int64 return value of int64 pointer or 0 if pointer is nil
func Int64Value(val *int64) int64 {
if val != nil {
return *val
}
return 0
}