Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MySQLOptions ¶
type MySQLOptions struct {
Host string `json:"host,omitempty" mapstructure:"host,omitempty"`
Port string `json:"port,omitempty" mapstructure:"port,omitempty"`
Username string `json:"username,omitempty" mapstructure:"username,omitempty"`
Password string `json:"password,omitempty" mapstructure:"password,omitempty"`
Database string `json:"database" mapstructure:"database"`
LogLevel int `json:"log-level,omitempty" mapstructure:"log-level,omitempty"`
//连接池会用到
MaxIdleConnections int `json:"max-idle-connections,omitempty" mapstructure:"max-idle-connections,omitempty"`
MaxConnectionLifetime time.Duration `json:"max-connection-lifetime,omitempty" mapstructure:"max-connection-lifetime,omitempty"`
MaxOpenConnections int `json:"max-open-connections,omitempty" mapstructure:"max-open-connections,omitempty"`
}
func NewMySQLOptions ¶
func NewMySQLOptions() *MySQLOptions
func (*MySQLOptions) AddFlags ¶
func (mo *MySQLOptions) AddFlags(fs *pflag.FlagSet)
AddFlags adds flags related to server storage for a specific APIServer to the specified FlagSet.
func (*MySQLOptions) Validate ¶
func (so *MySQLOptions) Validate() []error
Validate verifies flags passed to ServerOptions.
type RegistryOptions ¶
type RegistryOptions struct {
Address string `json:"address" mapstructure:"address,omitempty"`
// 指明基于什么进行注册 如:nacos consul etcd等,因为不通的注册中心 可能使用 http tcp grpc 等不同的协议
Scheme string `json:"scheme" mapstructure:"scheme,omitempty"`
}
RegistryOptions registry center options console, etcd, nacos etc.
func NewRegistryOptions ¶
func NewRegistryOptions() *RegistryOptions
NewRegistryOptions 创建一个默认注册中心的配置
func (*RegistryOptions) AddFlags ¶
func (o *RegistryOptions) AddFlags(fs *pflag.FlagSet)
AddFlags 将配置信息添加到 FlagSet 中
func (*RegistryOptions) Validate ¶
func (o *RegistryOptions) Validate() (errs []error)
Validate 校验配置是否正确
type ServerOptions ¶
type ServerOptions struct {
Name string `json:"name,omitempty" mapstructure:"name"` // 服务名称
Host string `json:"host,omitempty" mapstructure:"host"` // 服务地址
Port int `json:"port,omitempty" mapstructure:"port"` // 服务端口
HttpPort int `json:"http_port,omitempty" mapstructure:"http_port"` // http端口
EnableProfiling bool `json:"profiling,omitempty" mapstructure:"profiling"` // 是否开启性能分析
EnableLimit bool `json:"limit,omitempty" mapstructure:"limit"` // 是否开启限流
EnableMetrics bool `json:"metrics,omitempty" mapstructure:"metrics"` // 是否开启指标
EnableHealthCheck bool `json:"health_check,omitempty" mapstructure:"health_check"` // 是否开启健康检查
Middlewares []string `json:"middlewares,omitempty" mapstructure:"middlewares"` // 中间件
}
ServerOptions service discovery center options console, etcd, nacos etc.
func NewServerOptions ¶
func NewServerOptions() *ServerOptions
func (*ServerOptions) AddFlags ¶
func (so *ServerOptions) AddFlags(fs *pflag.FlagSet)
func (*ServerOptions) Validate ¶
func (so *ServerOptions) Validate() (errs []error)
type TelemetryOptions ¶
type TelemetryOptions struct {
// Name is the name of the service.
Name string `json:"name"`
// 连接地址
Endpoint string `json:"endpoint"`
// SampleRate is the rate at which traces are sampled. 1.0 means all traces are sampled, 0.0 means no traces are sampled.
// 意思是采样率,1.0表示所有的都采样,0.0表示不采样
Sampler float64 `json:"sampler"`
// Batcher is the type of batcher to use for sending traces to the collector.
// Batcher是用于将跟踪发送到收集器的批处理程序类型。
Batcher string `json:"batcher"`
}
func NewTelemetryOptions ¶
func NewTelemetryOptions() *TelemetryOptions
func (*TelemetryOptions) AddFlags ¶
func (t *TelemetryOptions) AddFlags(fs *pflag.FlagSet)
func (*TelemetryOptions) Validate ¶
func (t *TelemetryOptions) Validate() (errs []error)
Click to show internal directories.
Click to hide internal directories.