...
1
2
3
4
5
6
7
8 package protoreflect
9
10 import "google.golang.org/protobuf/internal/pragma"
11
12 type valueType int
13
14 const (
15 nilType valueType = iota
16 boolType
17 int32Type
18 int64Type
19 uint32Type
20 uint64Type
21 float32Type
22 float64Type
23 stringType
24 bytesType
25 enumType
26 ifaceType
27 )
28
29
30
31
32 type value struct {
33 pragma.DoNotCompare
34
35 typ valueType
36 num uint64
37 str string
38 bin []byte
39 iface interface{}
40 }
41
42 func valueOfString(v string) Value {
43 return Value{typ: stringType, str: v}
44 }
45 func valueOfBytes(v []byte) Value {
46 return Value{typ: bytesType, bin: v}
47 }
48 func valueOfIface(v interface{}) Value {
49 return Value{typ: ifaceType, iface: v}
50 }
51
52 func (v Value) getString() string {
53 return v.str
54 }
55 func (v Value) getBytes() []byte {
56 return v.bin
57 }
58 func (v Value) getIface() interface{} {
59 return v.iface
60 }
61
View as plain text