options

package
v0.9.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 10, 2022 License: MIT Imports: 1 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HeaderOption

type HeaderOption struct {
	Namerow int32
	Typerow int32
	Noterow int32
	Datarow int32

	Nameline int32
	Typeline int32
}

type InputOption

type InputOption struct {
	Formats []format.Format
	// Specify only those sub-directories (relative to input dir) to be processed.
	Subdirs []string
	// Rewrite subdir path.
	SubdirRewrites map[string]string
}

type Option

type Option func(*Options)

Option is the functional option type.

func Header(o *HeaderOption) Option

func Imports

func Imports(imports ...string) Option

func Input

func Input(o *InputOption) Option

func InputFormats added in v0.9.7

func InputFormats(formats ...format.Format) Option

func InputSubdirs added in v0.9.7

func InputSubdirs(subdirs ...string) Option

func LocationName

func LocationName(o string) Option

func LogLevel

func LogLevel(level string) Option

func Output

func Output(o *OutputOption) Option

func Workbook

func Workbook(wb string) Option

func Worksheet

func Worksheet(ws string) Option

type Options

type Options struct {
	LocationName string        // Location represents the collection of time offsets in use in a geographical area. Default is "Asia/Shanghai".
	LogLevel     string        // Log level: debug, info, warn, error
	Header       *HeaderOption // header rows of excel file.
	Input        *InputOption  // input settings.
	Output       *OutputOption // output settings.
	Imports      []string      // imported common proto file paths
	Workbook     string        // workbook path or name
	Worksheet    string        // worksheet name
}

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 NewDefault added in v0.9.7

func NewDefault() *Options

func ParseOptions

func ParseOptions(setters ...Option) *Options

type OutputOption

type OutputOption struct {
	// only for protogen generated protoconf file
	FilenameWithSubdirPrefix bool // default true, filename dir separator `/` or `\` is replaced by "__"
	FilenameSuffix           string

	// only for confgen generated JSON/Text/Wire file
	FilenameAsSnakeCase bool          // default false, output filename as snake case, default is camel case same as the protobuf message name.
	Format              format.Format // output pretty format, with mulitline and indent.
	Pretty              bool          // default true, output format: json, text, or wire, and default is json.
	// Output.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                 ║
	//  ╚═══════╧════════════════════════════╝
	EmitUnpopulated bool // default true
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL