client

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

client client端,主要包含client端调用的核心内容.

Index

Constants

This section is empty.

Variables

View Source
var ErrorServiceNotExist = errors.New("service not exist")

ErrorServiceNotExist 服务不存在错误.

Functions

func New

func New(o *Options) *defaultClient

Types

type Client

type Client interface {
	Invoke(ctx context.Context, req, rep interface{}, option ...Option) error
}

Client 调用接口.

type Option

type Option func(*Options)

func WithAddr

func WithAddr(addr string) Option

func WithAfterHandle

func WithAfterHandle(h []interceptor.ClientInvoker) Option

func WithBeforeHandle

func WithBeforeHandle(h []interceptor.ClientInvoker) Option

func WithClientName

func WithClientName(clientName string) Option

func WithCodecType

func WithCodecType(codecType string) Option

func WithCompressType

func WithCompressType(compressType string) Option

func WithDisableConnPool

func WithDisableConnPool(b bool) Option

func WithEnableMultiplexed

func WithEnableMultiplexed(b bool) Option

func WithMethod

func WithMethod(methodName string) Option

func WithNetWork

func WithNetWork(network string) Option

func WithPluginFactory

func WithPluginFactory(p *plugin.Factory) Option

func WithPluginFactoryOptions

func WithPluginFactoryOptions(o []plugin.Option) Option

func WithSerializerType

func WithSerializerType(serializerType string) Option

func WithService

func WithService(serviceName string) Option

type Options

type Options struct {
	ClientName        string `yaml:"name"`
	Addr              string `yaml:"address"`
	SerializerType    string `yaml:"serializer"`
	CodecType         string `yaml:"codec"`
	EnableMultiplexed bool   `yaml:"enable_multiplexed"`
	DisableConnPool   bool   `yaml:"disable_connection_pool"`
	NetWork           string `yaml:"network"`
	CompressType      string `yaml:"compress"`

	PluginFactoryOptions []plugin.Option
	PluginFactory        *plugin.Factory
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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