/
reader_options.go
54 lines (45 loc) · 1.06 KB
/
reader_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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package manifest
import "github.com/jhump/protoreflect/desc"
type Option func(r *Reader) *Reader
func SkipSourceCodeReader() Option {
return func(r *Reader) *Reader {
r.skipSourceCodeImportValidation = true
return r
}
}
func SkipModuleOutputTypeValidationReader() Option {
return func(r *Reader) *Reader {
r.skipModuleOutputTypeValidation = true
return r
}
}
func SkipPackageValidationReader() Option {
return func(r *Reader) *Reader {
r.skipPackageValidation = true
return r
}
}
func WithOverrideNetwork(network string) Option {
return func(r *Reader) *Reader {
r.overrideNetwork = network
return r
}
}
func WithOverrideOutputModule(outputModule string) Option {
return func(r *Reader) *Reader {
r.overrideOutputModule = outputModule
return r
}
}
func WithParams(params map[string]string) Option {
return func(r *Reader) *Reader {
r.params = params
return r
}
}
func WithCollectProtoDefinitions(f func(protoDefinitions []*desc.FileDescriptor)) Option {
return func(r *Reader) *Reader {
r.collectProtoDefinitionsFunc = f
return r
}
}