egrpc

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2020 License: MIT Imports: 21 Imported by: 16

Documentation

Index

Constants

View Source
const PackageName = "client.egrpc"

Variables

This section is empty.

Functions

This section is empty.

Types

type Component

type Component struct {
	*grpc.ClientConn
	// contains filtered or unexported fields
}

type Config

type Config struct {
	Addr                         string        // 连接地址,直连为127.0.0.1:9001,服务发现为etcd:///appname
	BalancerName                 string        // 负载均衡方式,默认round robin
	OnFail                       string        // 失败后的处理方式,panic | error
	DialTimeout                  time.Duration // 连接超时,默认3s
	ReadTimeout                  time.Duration // 读超时,默认1s
	SlowLogThreshold             time.Duration // 慢日志记录的阈值,默认600ms
	Debug                        bool          // 是否开启调试,默认不开启,开启后并加上export EGO_DEBUG=true,可以看到每次请求,配置名、地址、耗时、请求数据、响应数据
	EnableBlock                  bool          // 是否开启阻塞,默认开启
	EnableWithInsecure           bool          // 是否开启非安全传输,默认开启
	EnableMetricInterceptor      bool          // 是否开启监控,默认开启
	EnableTraceInterceptor       bool          // 是否开启链路追踪,默认开启
	EnableAppNameInterceptor     bool          // 是否开启传递应用名,默认开启
	EnableTimeoutInterceptor     bool          // 是否开启超时传递,默认开启
	EnableAccessInterceptor      bool          // 是否开启记录请求数据,默认不开启
	EnableAccessInterceptorReply bool          // 是否开启记录响应参数,默认不开启
	EnableAccessInterceptorReq   bool          // 是否开启记录请求参数,默认不开启
	// contains filtered or unexported fields
}

Config ...

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig ...

type Container

type Container struct {
	// contains filtered or unexported fields
}

func DefaultContainer

func DefaultContainer() *Container

func Load

func Load(key string) *Container

func (*Container) Build

func (c *Container) Build(options ...Option) *Component

Build ...

type Option

type Option func(c *Container)

func WithDialOption

func WithDialOption(opts ...grpc.DialOption) Option

WithDialOption ...

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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