options

package
v0.0.0-...-87b8bb5 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// FormatJSON json格式
	FormatJSON = "json"
	// FormatText test格式
	FormatText = "text"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ConnOptions

type ConnOptions struct {
	Username string `json:"username"   mapstructure:"username"`
	Password string `json:"password"   mapstructure:"password"`
	Ping     bool   `json:"ping"       mapstructure:"ping"`
	Address  string `json:"address"    mapstructure:"address"`
}

ConnOptions 连接选项参数

func NewConnOptions

func NewConnOptions() *ConnOptions

NewConnOptions return ConnOptions

func (*ConnOptions) AddFlags

func (co *ConnOptions) AddFlags(fs *pflag.FlagSet)

AddFlags 添加选项参数

func (*ConnOptions) Validate

func (co *ConnOptions) Validate() []error

Validate 验证选项参数

type LogOptions

type LogOptions struct {
	Formatter     string `json:"formatter" mapstructure:"formatter"`
	TimeFormatter string `json:"time-formatter" mapstructure:"time-formatter"`
	Level         string `json:"level" mapstructure:"level"`
}

LogOptions 日志选项参数

func NewLogOptions

func NewLogOptions() *LogOptions

NewLogOptions return LogOptions

func (*LogOptions) AddFlags

func (lo *LogOptions) AddFlags(fs *pflag.FlagSet)

AddFlags 添加选项参数

func (*LogOptions) Validate

func (lo *LogOptions) Validate() []error

Validate 验证选项参数

type Options

type Options struct {
	ConnOptions *ConnOptions `json:"conn" mapstructure:"conn"`
	LogOptions  *LogOptions  `json:"log" mapstructure:"log"`
}

Options 服务自定义选项

func NewOptions

func NewOptions() *Options

NewOptions return Options

func (*Options) Flags

func (o *Options) Flags() (fss cliflag.NamedFlagSets)

Flags 填充服务自定义选项并返回选项集

func (*Options) Validate

func (o *Options) Validate() []error

Validate 验证服务选项

Jump to

Keyboard shortcuts

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