options

package
v0.7.5 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2022 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Format

type Format int
const (
	JSON      Format = 0
	Protowire Format = 1
	Prototext Format = 2
	Excel     Format = 3
	CSV       Format = 4
	XML       Format = 5
)

file format

func Ext2Format added in v0.7.5

func Ext2Format(ext string) Format

type HeaderOption

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

	Nameline int32
	Typeline int32
}

type InputOption added in v0.7.5

type InputOption struct {
	Format Format
}

type Option

type Option func(*Options)

Option is the functional option type.

func Header(o *HeaderOption) Option

func Imports added in v0.5.7

func Imports(imports []string) Option

func Input added in v0.7.5

func Input(o *InputOption) Option

func LocationName

func LocationName(o string) Option

func LogLevel

func LogLevel(level string) Option

func Output

func Output(o *OutputOption) Option

func Workbook added in v0.7.2

func Workbook(wb string) Option

func Worksheet added in v0.7.2

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.
	Output       *OutputOption // output settings.
	Input        *InputOption  // input 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 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/prototext/protowire file
	FilenameAsSnakeCase bool   // default false, output filename as snake case, default is camel case same as the protobuf message name.
	Format              Format // output pretty format, with mulitline and indent.
	Pretty              bool   // default true, output format: json, protowire, or prototext, 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