client

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AttrNameWeight      = "attr_weight"
	AttrNameReadWeight  = "attr_read_weight"
	AttrNameWriteWeight = "attr_write_weight"
	AttrNameGroup       = "attr_group"
	AttrNameNode        = "attr_node"
)

Variables

This section is empty.

Functions

func ContextBizId

func ContextBizId(ctx context.Context) (uint64, bool)

ContextBizId 从 context.Context 获取 business id

func ContextGroup

func ContextGroup(ctx context.Context) (string, bool)

func ContextReqType

func ContextReqType(ctx context.Context) (uint8, bool)

ContextReqType 从 context.Context 获取 request type

func ContextWithBizId

func ContextWithBizId(ctx context.Context, bizId uint64) context.Context

ContextWithBizId 在 context.Context 内写入 business id

func ContextWithGroup

func ContextWithGroup(ctx context.Context, group string) context.Context

ContextWithGroup 在 context.Context 内写入 group 信息

func ContextWithReqType

func ContextWithReqType(ctx context.Context, reqType uint8) context.Context

ContextWithReqType 在 context.Context 内写入 request type 信息 read request = 0 write request = 1

Types

type Manager added in v0.0.5

type Manager[T any] struct {
	// contains filtered or unexported fields
}

Manager grpc 客户端管理器

func (*Manager[T]) Close added in v0.0.12

func (m *Manager[T]) Close(serviceName string) error

Close 关闭指定服务连接

func (*Manager[T]) CloseAll added in v0.0.12

func (m *Manager[T]) CloseAll() error

CloseAll 关闭所有连接

func (*Manager[T]) Get added in v0.0.5

func (m *Manager[T]) Get(serviceName string) (T, error)

type ManagerBuilder added in v0.0.8

type ManagerBuilder[T any] struct {
	// contains filtered or unexported fields
}

ManagerBuilder grpc 客户端管理器 builder

func NewManagerBuilder added in v0.0.8

func NewManagerBuilder[T any](rb resolver.Builder, bb balancer.Builder, creator func(conn *grpc.ClientConn) T) *ManagerBuilder[T]

func (*ManagerBuilder[T]) BalancerBuilder added in v0.0.8

func (b *ManagerBuilder[T]) BalancerBuilder(bb balancer.Builder) *ManagerBuilder[T]

func (*ManagerBuilder[T]) Build added in v0.0.8

func (b *ManagerBuilder[T]) Build() *Manager[T]

func (*ManagerBuilder[T]) Creator added in v0.0.8

func (b *ManagerBuilder[T]) Creator(creator func(conn *grpc.ClientConn) T) *ManagerBuilder[T]

func (*ManagerBuilder[T]) Insecure added in v0.0.8

func (b *ManagerBuilder[T]) Insecure() *ManagerBuilder[T]

func (*ManagerBuilder[T]) KeepAlive added in v0.0.12

func (b *ManagerBuilder[T]) KeepAlive(params keepalive.ClientParameters) *ManagerBuilder[T]

func (*ManagerBuilder[T]) ResolverBuilder added in v0.0.8

func (b *ManagerBuilder[T]) ResolverBuilder(rb resolver.Builder) *ManagerBuilder[T]

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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