-
Notifications
You must be signed in to change notification settings - Fork 0
/
new.go
105 lines (87 loc) · 2.41 KB
/
new.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
package ptr
import "time"
// NewInt initiate a new pointer value with the default value of the certain type
func NewInt() *int {
var i = int(0)
return &i
}
// NewInt8 initiate a new pointer value with the default value of the certain type
func NewInt8() *int8 {
var i = int8(0)
return &i
}
// NewInt16 initiate a new pointer value with the default value of the certain type
func NewInt16() *int16 {
var i = int16(0)
return &i
}
// NewInt32 initiate a new pointer value with the default value of the certain type
func NewInt32() *int32 {
var i = int32(0)
return &i
}
// NewInt64 initiate a new pointer value with the default value of the certain type
func NewInt64() *int64 {
var i = int64(0)
return &i
}
// NewUint initiate a new pointer value with the default value of the certain type
func NewUint() *uint {
var i = uint(0)
return &i
}
// NewUint8 initiate a new pointer value with the default value of the certain type
func NewUint8() *uint8 {
var i = uint8(0)
return &i
}
// NewUint16 initiate a new pointer value with the default value of the certain type
func NewUint16() *uint16 {
var i = uint16(0)
return &i
}
// NewUint32 initiate a new pointer value with the default value of the certain type
func NewUint32() *uint32 {
var i = uint32(0)
return &i
}
// NewUint64 initiate a new pointer value with the default value of the certain type
func NewUint64() *uint64 {
var i = uint64(0)
return &i
}
// NewFloat32 initiate a new pointer value with the default value of the certain type
func NewFloat32() *float32 {
var i = float32(0)
return &i
}
// NewFloat64 initiate a new pointer value with the default value of the certain type
func NewFloat64() *float64 {
var i = float64(0)
return &i
}
// NewBool initiate a new pointer value with the default value of the certain type
func NewBool() *bool {
var b = false
return &b
}
// NewString initiate a new pointer value with the default value of the certain type
func NewString() *string {
var s = ""
return &s
}
// NewComplex64 initiate a new pointer value with the default value of the certain type
func NewComplex64() *complex64 {
var c = complex64(0)
return &c
}
// NewComplex128 initiate a new pointer value with the default value of the certain type
func NewComplex128() *complex128 {
var c = complex128(0)
return &c
}
// NewTime initiate a new pointer value with the default value of the certain type
func NewTime() *time.Time {
var t = time.Time{}
return &t
}