@@ -4,69 +4,69 @@ import (
4
4
"google.golang.org/protobuf/reflect/protoreflect"
5
5
)
6
6
7
- var kindToGenerator = map [protoreflect.Kind ]func (fd protoreflect.FieldDescriptor ) * protoreflect.Value {
8
- protoreflect .BoolKind : func (fd protoreflect.FieldDescriptor ) * protoreflect.Value {
9
- v := protoreflect .ValueOfBool (true )
7
+ var kindToGenerator = map [protoreflect.Kind ]func (fd protoreflect.FieldDescriptor , opts GenOptions ) * protoreflect.Value {
8
+ protoreflect .BoolKind : func (fd protoreflect.FieldDescriptor , opts GenOptions ) * protoreflect.Value {
9
+ v := protoreflect .ValueOfBool (Bool ( fd , opts ) )
10
10
return & v
11
11
},
12
- protoreflect .EnumKind : func (fd protoreflect.FieldDescriptor ) * protoreflect.Value {
13
- v := protoreflect .ValueOfEnum (Enum (fd ))
12
+ protoreflect .EnumKind : func (fd protoreflect.FieldDescriptor , opts GenOptions ) * protoreflect.Value {
13
+ v := protoreflect .ValueOfEnum (Enum (fd , opts ))
14
14
return & v
15
15
},
16
- protoreflect .StringKind : func (fd protoreflect.FieldDescriptor ) * protoreflect.Value {
17
- v := protoreflect .ValueOfString (String (fd ))
16
+ protoreflect .StringKind : func (fd protoreflect.FieldDescriptor , opts GenOptions ) * protoreflect.Value {
17
+ v := protoreflect .ValueOfString (String (fd , opts ))
18
18
return & v
19
19
},
20
- protoreflect .BytesKind : func (fd protoreflect.FieldDescriptor ) * protoreflect.Value {
21
- v := protoreflect .ValueOfBytes (Bytes (fd ))
20
+ protoreflect .BytesKind : func (fd protoreflect.FieldDescriptor , opts GenOptions ) * protoreflect.Value {
21
+ v := protoreflect .ValueOfBytes (Bytes (fd , opts ))
22
22
return & v
23
23
},
24
- protoreflect .Int32Kind : func (fd protoreflect.FieldDescriptor ) * protoreflect.Value {
25
- v := protoreflect .ValueOfInt32 (Int32 (fd ))
24
+ protoreflect .Int32Kind : func (fd protoreflect.FieldDescriptor , opts GenOptions ) * protoreflect.Value {
25
+ v := protoreflect .ValueOfInt32 (Int32 (fd , opts ))
26
26
return & v
27
27
},
28
- protoreflect .Sint32Kind : func (fd protoreflect.FieldDescriptor ) * protoreflect.Value {
29
- v := protoreflect .ValueOfInt32 (SInt32 (fd ))
28
+ protoreflect .Sint32Kind : func (fd protoreflect.FieldDescriptor , opts GenOptions ) * protoreflect.Value {
29
+ v := protoreflect .ValueOfInt32 (SInt32 (fd , opts ))
30
30
return & v
31
31
},
32
- protoreflect .Sfixed32Kind : func (fd protoreflect.FieldDescriptor ) * protoreflect.Value {
33
- v := protoreflect .ValueOfInt32 (SFixed32 (fd ))
32
+ protoreflect .Sfixed32Kind : func (fd protoreflect.FieldDescriptor , opts GenOptions ) * protoreflect.Value {
33
+ v := protoreflect .ValueOfInt32 (SFixed32 (fd , opts ))
34
34
return & v
35
35
},
36
- protoreflect .Uint32Kind : func (fd protoreflect.FieldDescriptor ) * protoreflect.Value {
37
- v := protoreflect .ValueOfUint32 (UInt32 (fd ))
36
+ protoreflect .Uint32Kind : func (fd protoreflect.FieldDescriptor , opts GenOptions ) * protoreflect.Value {
37
+ v := protoreflect .ValueOfUint32 (UInt32 (fd , opts ))
38
38
return & v
39
39
},
40
- protoreflect .Fixed32Kind : func (fd protoreflect.FieldDescriptor ) * protoreflect.Value {
41
- v := protoreflect .ValueOfUint32 (Fixed32 (fd ))
40
+ protoreflect .Fixed32Kind : func (fd protoreflect.FieldDescriptor , opts GenOptions ) * protoreflect.Value {
41
+ v := protoreflect .ValueOfUint32 (Fixed32 (fd , opts ))
42
42
return & v
43
43
},
44
- protoreflect .Int64Kind : func (fd protoreflect.FieldDescriptor ) * protoreflect.Value {
45
- v := protoreflect .ValueOfInt64 (Int64 (fd ))
44
+ protoreflect .Int64Kind : func (fd protoreflect.FieldDescriptor , opts GenOptions ) * protoreflect.Value {
45
+ v := protoreflect .ValueOfInt64 (Int64 (fd , opts ))
46
46
return & v
47
47
},
48
- protoreflect .Sint64Kind : func (fd protoreflect.FieldDescriptor ) * protoreflect.Value {
49
- v := protoreflect .ValueOfInt64 (SInt64 (fd ))
48
+ protoreflect .Sint64Kind : func (fd protoreflect.FieldDescriptor , opts GenOptions ) * protoreflect.Value {
49
+ v := protoreflect .ValueOfInt64 (SInt64 (fd , opts ))
50
50
return & v
51
51
},
52
- protoreflect .Sfixed64Kind : func (fd protoreflect.FieldDescriptor ) * protoreflect.Value {
53
- v := protoreflect .ValueOfInt64 (SFixed64 (fd ))
52
+ protoreflect .Sfixed64Kind : func (fd protoreflect.FieldDescriptor , opts GenOptions ) * protoreflect.Value {
53
+ v := protoreflect .ValueOfInt64 (SFixed64 (fd , opts ))
54
54
return & v
55
55
},
56
- protoreflect .Uint64Kind : func (fd protoreflect.FieldDescriptor ) * protoreflect.Value {
57
- v := protoreflect .ValueOfUint64 (UInt64 (fd ))
56
+ protoreflect .Uint64Kind : func (fd protoreflect.FieldDescriptor , opts GenOptions ) * protoreflect.Value {
57
+ v := protoreflect .ValueOfUint64 (UInt64 (fd , opts ))
58
58
return & v
59
59
},
60
- protoreflect .Fixed64Kind : func (fd protoreflect.FieldDescriptor ) * protoreflect.Value {
61
- v := protoreflect .ValueOfUint64 (Fixed64 (fd ))
60
+ protoreflect .Fixed64Kind : func (fd protoreflect.FieldDescriptor , opts GenOptions ) * protoreflect.Value {
61
+ v := protoreflect .ValueOfUint64 (Fixed64 (fd , opts ))
62
62
return & v
63
63
},
64
- protoreflect .FloatKind : func (fd protoreflect.FieldDescriptor ) * protoreflect.Value {
65
- v := protoreflect .ValueOfFloat32 (Float32 (fd ))
64
+ protoreflect .FloatKind : func (fd protoreflect.FieldDescriptor , opts GenOptions ) * protoreflect.Value {
65
+ v := protoreflect .ValueOfFloat32 (Float32 (fd , opts ))
66
66
return & v
67
67
},
68
- protoreflect .DoubleKind : func (fd protoreflect.FieldDescriptor ) * protoreflect.Value {
69
- v := protoreflect .ValueOfFloat64 (Float64 (fd ))
68
+ protoreflect .DoubleKind : func (fd protoreflect.FieldDescriptor , opts GenOptions ) * protoreflect.Value {
69
+ v := protoreflect .ValueOfFloat64 (Float64 (fd , opts ))
70
70
return & v
71
71
},
72
72
}
@@ -109,5 +109,5 @@ func getFieldValue(fd protoreflect.FieldDescriptor, opts GenOptions) *protorefle
109
109
if ! ok {
110
110
return nil
111
111
}
112
- return fn (fd )
112
+ return fn (fd , opts )
113
113
}
0 commit comments