github.com/sanposhiho/openapi2proto@v0.0.0-20230521044535-d1080a134e37/options.go (about)

     1  package openapi2proto
     2  
     3  import (
     4  	"github.com/sanposhiho/openapi2proto/compiler"
     5  	"github.com/sanposhiho/openapi2proto/internal/option"
     6  	"github.com/sanposhiho/openapi2proto/protobuf"
     7  )
     8  
     9  const (
    10  	optkeyEncoderOptions  = "protobuf-encoder-options"
    11  	optkeyCompilerOptions = "protobuf-compiler-options"
    12  )
    13  
    14  // Option is used to pass options to several methods
    15  type Option option.Option
    16  
    17  // WithEncoderOptions allows you to specify a list of
    18  // options to `Transpile`, which gets passed to the
    19  // protobuf.Encoder object.
    20  func WithEncoderOptions(options ...protobuf.Option) Option {
    21  	return option.New(optkeyEncoderOptions, options)
    22  }
    23  
    24  // WithCompilerOptions allows you to specify a list of
    25  // options to `Transpile`, which gets passed to the
    26  // protobuf.Compile method
    27  func WithCompilerOptions(options ...compiler.Option) Option {
    28  	return option.New(optkeyCompilerOptions, options)
    29  }