-
Notifications
You must be signed in to change notification settings - Fork 0
/
options.go
31 lines (24 loc) · 962 Bytes
/
options.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
package patch
import (
gopb "github.com/hopeio/cherry/protobuf/utils/patch"
"google.golang.org/protobuf/compiler/protogen"
"google.golang.org/protobuf/proto"
)
func enumOptions(e *protogen.Enum) *gopb.Options {
return proto.GetExtension(e.Desc.Options(), gopb.E_Enum).(*gopb.Options)
}
func valueOptions(v *protogen.EnumValue) *gopb.Options {
return proto.GetExtension(v.Desc.Options(), gopb.E_Value).(*gopb.Options)
}
func messageOptions(m *protogen.Message) *gopb.Options {
return proto.GetExtension(m.Desc.Options(), gopb.E_Message).(*gopb.Options)
}
func fieldOptions(f *protogen.Field) *gopb.Options {
return proto.GetExtension(f.Desc.Options(), gopb.E_Field).(*gopb.Options)
}
func oneofOptions(o *protogen.Oneof) *gopb.Options {
return proto.GetExtension(o.Desc.Options(), gopb.E_Oneof).(*gopb.Options)
}
func fileOptions(o *protogen.File) *gopb.FileOptions {
return proto.GetExtension(o.Desc.Options(), gopb.E_File).(*gopb.FileOptions)
}