options

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2021 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

View Source
const (
	JSON      Format = 0
	Protowire        = 1
	Prototext        = 2
)

file format

Variables

This section is empty.

Functions

This section is empty.

Types

type Format

type Format int

type HeaderOption

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

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 LocationName

func LocationName(o string) Option

func LogLevel

func LogLevel(level string) Option

func Output

func Output(o *OutputOption) 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.
	Imports      []string      // imported common proto file paths
}

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 {
	FilenameAsSnakeCase bool   // 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   // 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
}

Jump to

Keyboard shortcuts

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