Documentation
¶
Index ¶
- type HeaderOption
- type InputOption
- type Option
- func Header(o *HeaderOption) Option
- func ImportPaths(importPaths ...string) Option
- func Imports(imports ...string) Option
- func Input(o *InputOption) Option
- func InputFormats(formats ...format.Format) Option
- func InputSubdirs(subdirs ...string) Option
- func LocationName(o string) Option
- func LogLevel(level string) Option
- func Output(o *OutputOption) Option
- func OutputFormats(formats ...format.Format) Option
- func Workbook(wb string) Option
- func Worksheet(ws string) Option
- type Options
- type OutputOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HeaderOption ¶
type HeaderOption struct { // Exact row number of column name definition at a worksheet. // Default: 1. Namerow int32 // Exact row number of column type definition at a worksheet. // Default: 2. Typerow int32 // Exact row number of column note at a worksheet. // Default: 3. Noterow int32 // Start row number of data at a worksheet. // Default: 4. Datarow int32 // The line number of column name definition in a cell. // Value 0 means the whole cell. // Default: 0. Nameline int32 // The line number of column type definition in a cell. // Value 0 means the whole cell. // Default: 0. Typeline int32 }
type InputOption ¶
type InputOption struct { // Only for protogen: input file formats. // Note: recognize all formats (Excel, CSV, and XML) if not set (value is nil). // Default: nil. Formats []format.Format // - For protogen, specify only these subdirs (relative to input dir) to be processed. // - For confgen, specify only these subdirs (relative to workbook name option in .proto file). Subdirs []string // - For protogen, rewrite subdir path (relative to input dir). // - For confgen, rewrite subdir path (relative to workbook name option in .proto file). SubdirRewrites map[string]string }
type Option ¶
type Option func(*Options)
Option is the functional option type.
func ImportPaths ¶ added in v0.9.12
ImportPaths specifies the paths used to search for dependencies that are referenced in import statements in proto source files. If no import paths are provided then "." (current directory) is assumed to be the only import path.
func InputFormats ¶ added in v0.9.7
InputFormats sets input formats.
func InputSubdirs ¶ added in v0.9.7
InputSubdirs sets input subdirs.
func OutputFormats ¶ added in v0.9.10
OutputFormats sets output formats.
type Options ¶
type Options struct { // Location represents the collection of time offsets in use in a geographical area. // Default: "Asia/Shanghai". LocationName string LogLevel string // Log level: debug, info, warn, error. Default: "info". Header *HeaderOption // Header options of worksheet file. Input *InputOption // Input options. Output *OutputOption // Output options. ImportPaths []string // Import paths. Default: nil. Imports []string // Import common proto files. Default: nil. Workbook string // Workbook filename. Default: "". Worksheet string // Worksheet name. Default: "". }
Options is the wrapper of tableau params. Options follow the design of Functional Options (https://github.com/tmrts/go-patterns/blob/master/idiom/functional-options.md).
func ParseOptions ¶
ParseOptions parses functional options and merge them to default Options.
type OutputOption ¶
type OutputOption struct { // Only for protogen: dir separator `/` or `\` in filename is replaced by "__". // Default: true. FilenameWithSubdirPrefix bool // Only for protogen: append the suffix to filename. // Default: "". FilenameSuffix string // Only for confgen: output filename as snake_case, default is CamelCase as the protobuf message name. // Default: false. FilenameAsSnakeCase bool // Only for confgen: output file formats. // Note: Output all formats (JSON, Text, and Wire) if not set (value is nil). // Default: nil. Formats []format.Format // Only for confgen: output pretty format, with multiline and indent. // Default: true. Pretty bool // EmitUnpopulated specifies whether to emit unpopulated fields. It does not // emit unpopulated oneof fields or unpopulated extension fields. // The JSON value emitted for unpopulated fields are as follows: // ╔═══════╤════════════════════════════╗ // ║ JSON │ Protobuf field ║ // ╠═══════╪════════════════════════════╣ // ║ false │ proto3 boolean fields ║ // ║ 0 │ proto3 numeric fields ║ // ║ "" │ proto3 string/bytes fields ║ // ║ null │ proto2 scalar fields ║ // ║ null │ message fields ║ // ║ [] │ list fields ║ // ║ {} │ map fields ║ // ╚═══════╧════════════════════════════╝ // // Default: true. EmitUnpopulated bool }
Click to show internal directories.
Click to hide internal directories.