-
Notifications
You must be signed in to change notification settings - Fork 0
/
model.go
40 lines (35 loc) · 1.07 KB
/
model.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
package marker
import (
"reflect"
)
type (
Marker struct {
Name string
Value reflect.Value
}
)
var (
BoolValue = reflect.ValueOf(false)
IntValue = reflect.ValueOf(0)
Int8Value = reflect.ValueOf(int8(0))
Int16Value = reflect.ValueOf(int16(0))
Int32Value = reflect.ValueOf(int32(0))
Int64Value = reflect.ValueOf(int64(0))
UintValue = reflect.ValueOf(uint(0))
Uint8Value = reflect.ValueOf(uint8(0))
Uint16Value = reflect.ValueOf(uint16(0))
Uint32Value = reflect.ValueOf(uint32(0))
Uint64Value = reflect.ValueOf(uint64(0))
UintptrValue = reflect.ValueOf(uintptr(0))
Float32Value = reflect.ValueOf(float32(0.0))
Float64Value = reflect.ValueOf(0.0)
StringValue = reflect.ValueOf("")
Complex64Value = reflect.ValueOf(complex64(0.0))
Complex128Value = reflect.ValueOf(complex128(0.0))
)
func NewMarker(name string, value interface{}) *Marker {
return NewValueMarker(name, reflect.ValueOf(value))
}
func NewValueMarker(name string, value reflect.Value) *Marker {
return &Marker{name, value}
}