-
Notifications
You must be signed in to change notification settings - Fork 98
/
Copy pathoptions.go
29 lines (24 loc) · 870 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
package openapi2proto
import (
"github.com/NYTimes/openapi2proto/compiler"
"github.com/NYTimes/openapi2proto/internal/option"
"github.com/NYTimes/openapi2proto/protobuf"
)
const (
optkeyEncoderOptions = "protobuf-encoder-options"
optkeyCompilerOptions = "protobuf-compiler-options"
)
// Option is used to pass options to several methods
type Option option.Option
// WithEncoderOptions allows you to specify a list of
// options to `Transpile`, which gets passed to the
// protobuf.Encoder object.
func WithEncoderOptions(options ...protobuf.Option) Option {
return option.New(optkeyEncoderOptions, options)
}
// WithCompilerOptions allows you to specify a list of
// options to `Transpile`, which gets passed to the
// protobuf.Compile method
func WithCompilerOptions(options ...compiler.Option) Option {
return option.New(optkeyCompilerOptions, options)
}