Documentation
¶
Index ¶
- type HeaderOption
- type InputConfOption
- type InputOption
- type InputProtoOption
- type LogOption
- type Option
- func Input(o *InputOption) Option
- func InputConf(o *InputConfOption) Option
- func InputProto(o *InputProtoOption) Option
- func LocationName(o string) Option
- func Log(o *LogOption) Option
- func Output(o *OutputOption) Option
- func OutputConf(o *OutputConfOption) Option
- func OutputProto(o *OutputProtoOption) Option
- type Options
- type OutputConfOption
- type OutputOption
- type OutputProtoOption
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 InputConfOption ¶ added in v0.10.0
type InputConfOption struct {
// The proto paths are 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.
ProtoPaths []string `yaml:"protoPaths"`
// The files to be parsed to generate configurations.
//
// NOTE: Glob patterns is supported, which can specify sets
// of filenames with wildcard characters.
//
// Default: nil.
ProtoFiles []string `yaml:"protoFiles"`
// The files not to be parsed to generate configurations.
//
// NOTE: Glob patterns is supported, which can specify sets
// of filenames with wildcard characters.
//
// Default: nil.
ExcludedProtoFiles []string `yaml:"excludedProtoFiles"`
// Specify input file formats to be parsed.
// Note: recognize all formats (Excel/CSV/XML) if not set (value is nil).
// Default: nil.
Formats []format.Format
// Specify only these subdirs (relative to workbook name option in proto file).
Subdirs []string
// Specify rewrite subdir path (relative to workbook name option in proto file).
// Default: nil.
SubdirRewrites map[string]string `yaml:"subdirRewrites"`
}
Input options for generating conf files. Only for confgen.
type InputOption ¶
type InputOption struct {
// Input options for generating proto files.
Proto *InputProtoOption `yaml:"proto"`
// Input options for generating conf files.
Conf *InputConfOption `yaml:"conf"`
}
type InputProtoOption ¶ added in v0.10.0
type InputProtoOption struct {
// Header options of worksheet.
Header *HeaderOption `yaml:"header"`
// The proto paths are 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.
ProtoPaths []string `yaml:"protoPaths"`
// The enums and messages in ImportedProtoFiles can be used in Excel/CSV/XML as
// common types.
// Default: nil.
ImportedProtoFiles []string `yaml:"importedProtoFiles"`
// Specify input file formats.
// Note: recognize all formats (Excel/CSV/XML) if not set (value is nil).
// Default: nil.
Formats []format.Format `yaml:"formats"`
// Specify only these subdirs (relative to input dir) to be processed.
Subdirs []string `yaml:"subdirs"`
// Specify rewrite subdir path (relative to input dir).
// Default: nil.
SubdirRewrites map[string]string `yaml:"subdirRewrites"`
// 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"`
}
Input options for generating proto files. Only for protogen.
type Option ¶
type Option func(*Options)
Option is the functional option type.
func InputConf ¶ added in v0.10.0
func InputConf(o *InputConfOption) Option
InputConf set options for generating conf files.
func InputProto ¶ added in v0.10.0
func InputProto(o *InputProtoOption) Option
InputProto set options for generating proto files.
func LocationName ¶
LocationName sets TZ location name for parsing datetime format.
func OutputConf ¶ added in v0.10.0
func OutputConf(o *OutputConfOption) Option
OutputConf set options for generating conf files.
func OutputProto ¶ added in v0.10.0
func OutputProto(o *OutputProtoOption) Option
OutputProto set options for generating proto files.
type Options ¶
type Options struct {
// Location represents the collection of time offsets in use in a geographical area.
// If the name is "" or "UTC", LoadLocation returns UTC.
// If the name is "Local", LoadLocation returns Local.
// Default: "Local".
LocationName string `yaml:"locationName"`
Log *LogOption // Log options.
Input *InputOption `yaml:"input"` // Input options.
Output *OutputOption `yaml:"output"` // Output options.
}
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 OutputConfOption ¶ added in v0.10.0
type OutputConfOption struct {
// Specify subdir (relative to output dir) for generated configuration files.
// Default: "".
Subdir string `yaml:"subdir"`
// Specify generated conf file formats. If not set, it will generate all formats
// (JSON, Text, and Wire) .
// Default: nil.
Formats []format.Format
// Output pretty format, with multiline and indent.
// Default: false.
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"`
}
Output options for generating conf files. Only for confgen.
type OutputOption ¶
type OutputOption struct {
// Output options for generating proto files.
Proto *OutputProtoOption `yaml:"proto"`
// Output options for generating conf files.
Conf *OutputConfOption `yaml:"conf"`
}
type OutputProtoOption ¶ added in v0.10.0
type OutputProtoOption struct {
// Specify subdir (relative to output dir) for generated proto files.
// Default: "".
Subdir string `yaml:"subdir"`
// Dir separator `/` or `\` in filename is replaced by "__".
// Default: false.
FilenameWithSubdirPrefix bool `yaml:"filenameWithSubdirPrefix"`
// Append suffix to generated proto filename.
// Default: "".
FilenameSuffix string `yaml:"filenameSuffix"`
// Specify proto file options.
// Example: go_package, csharp_namespace...
// Default: nil.
FileOptions map[string]string `yaml:"fileOptions"`
}
Output options for generating proto files. Only for protogen.