Documentation
¶
Index ¶
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
// 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.
// Default: nil.
ImportPaths []string `yaml:"importPaths"`
// The files in "ImportPaths" used to search for dependencies that are referenced in import
// statements in proto source files.
// Default: nil.
ImportFiles []string `yaml:"importFiles"`
// The files to be parsed to generate configurations.
// Default: nil.
ProtoFiles []string `yaml:"protoFiles"`
// - 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).
//
// Default: nil.
SubdirRewrites map[string]string `yaml:"subdirRewrites"`
// Only for protogen: follow the symbolic links when traversing directories recursively.
// WARN: be careful to use this option, it may lead to infinite loop.
// Default: false.
FollowSymlink bool `yaml:"followSymlink"`
}
type Options ¶
type Options struct {
// Location represents the collection of time offsets in use in a geographical area.
// Default: "Asia/Shanghai".
LocationName string `yaml:"locationName"`
// Log level: debug, info, warn, error. Default: "info".
LogLevel string `yaml:"logLevel"`
Header *HeaderOption // Header options of worksheet.
Input *InputOption // Input options.
Output *OutputOption // Output options.
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: specify subdir for generated proto files in output dir.
// Default: "".
ProtoSubdir string `yaml:"protoSubdir"`
// Only for confgen: specify subdir for generated configuration files in output dir.
// Default: "".
ConfSubdir string `yaml:"confSubdir"`
// Only for protogen: dir separator `/` or `\` in filename is replaced by "__".
// Default: true.
ProtoFilenameWithSubdirPrefix bool `yaml:"protoFilenameWithSubdirPrefix"`
// Only for protogen: append the suffix to filename.
// Default: "".
ProtoFilenameSuffix string `yaml:"protoFilenameSuffix"`
// Only for confgen: output file formats. It will output all formats
// (JSON, Text, and Wire) if not set.
// 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 ║
// ╚═══════╧════════════════════════════╝
//
// NOTE: worksheet with FieldPresence set as true ignore this option.
//
// Refer: https://github.com/protocolbuffers/protobuf/blob/main/docs/field_presence.md
//
// Default: false.
EmitUnpopulated bool `yaml:"emitUnpopulated"`
// Only for proto file options. Default: nil.
// Example: go_package, csharp_namespace...
ProtoFileOptions map[string]string `yaml:"protoFileOptions"`
}
Click to show internal directories.
Click to hide internal directories.