Documentation ¶
Index ¶
- func LocalIPv4(name ...string) (ipAddr string, err error)
- func StreamServerInterceptor(f GrpcContextHandler) grpc.StreamServerInterceptor
- func UnaryServerInterceptor(f GrpcContextHandler) grpc.UnaryServerInterceptor
- type ClientOption
- func WithClientAddress(address string) ClientOption
- func WithClientDiscovery(discovery resolver.Discovery) ClientOption
- func WithClientLogger(log Logger) ClientOption
- func WithClientName(name string) ClientOption
- func WithClientStreamClientInterceptors(streamClientInterceptors ...grpc.StreamClientInterceptor) ClientOption
- func WithClientUnaryClientInterceptors(unaryClientInterceptors ...grpc.UnaryClientInterceptor) ClientOption
- type ClientOptions
- type GrpcClient
- type GrpcContextHandler
- type GrpcServer
- type Logger
- type ServerOption
- func WithServerAddress(address string) ServerOption
- func WithServerLogger(log Logger) ServerOption
- func WithServerName(name string) ServerOption
- func WithServerRandomPort(randomPort bool) ServerOption
- func WithServerRegister(register resolver.Registry) ServerOption
- func WithServerStreamServerInterceptors(streamServerInterceptors ...grpc.StreamServerInterceptor) ServerOption
- func WithServerUnaryServerInterceptors(unaryServerInterceptors ...grpc.UnaryServerInterceptor) ServerOption
- type ServerOptions
- type StdLogger
- func (StdLogger) Debugf(ctx context.Context, format string, args ...interface{})
- func (StdLogger) Debugln(ctx context.Context, args ...interface{})
- func (StdLogger) Errorf(ctx context.Context, format string, args ...interface{})
- func (StdLogger) Errorln(ctx context.Context, args ...interface{})
- func (StdLogger) Fatalf(ctx context.Context, format string, args ...interface{})
- func (StdLogger) Fatalln(ctx context.Context, args ...interface{})
- func (StdLogger) Infof(ctx context.Context, format string, args ...interface{})
- func (StdLogger) Infoln(ctx context.Context, args ...interface{})
- func (StdLogger) Warnf(ctx context.Context, format string, args ...interface{})
- func (StdLogger) Warnln(ctx context.Context, args ...interface{})
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func StreamServerInterceptor ¶
func StreamServerInterceptor(f GrpcContextHandler) grpc.StreamServerInterceptor
StreamServerInterceptor ...
func UnaryServerInterceptor ¶
func UnaryServerInterceptor(f GrpcContextHandler) grpc.UnaryServerInterceptor
UnaryServerInterceptor ...
Types ¶
type ClientOption ¶ added in v2.2.0
type ClientOption func(*ClientOptions)
ClientOption 为可选参数赋值的函数
func WithClientAddress ¶ added in v2.2.0
func WithClientAddress(address string) ClientOption
func WithClientDiscovery ¶ added in v2.2.0
func WithClientDiscovery(discovery resolver.Discovery) ClientOption
func WithClientLogger ¶ added in v2.2.0
func WithClientLogger(log Logger) ClientOption
func WithClientName ¶ added in v2.2.0
func WithClientName(name string) ClientOption
func WithClientStreamClientInterceptors ¶ added in v2.2.0
func WithClientStreamClientInterceptors(streamClientInterceptors ...grpc.StreamClientInterceptor) ClientOption
func WithClientUnaryClientInterceptors ¶ added in v2.2.0
func WithClientUnaryClientInterceptors(unaryClientInterceptors ...grpc.UnaryClientInterceptor) ClientOption
type ClientOptions ¶ added in v2.2.0
type ClientOptions struct { Name string Address string Log Logger StreamClientInterceptors []grpc.StreamClientInterceptor UnaryClientInterceptors []grpc.UnaryClientInterceptor // contains filtered or unexported fields }
ClientOptions 可选参数列表
func NewClientOptions ¶ added in v2.2.0
func NewClientOptions(opts ...ClientOption) ClientOptions
NewClientOptions 创建可选参数
type GrpcClient ¶
type GrpcClient struct {
// contains filtered or unexported fields
}
GrpcClient grpc客户端
func NewGrpcClient ¶
func NewGrpcClient(ctx context.Context, opts ...ClientOption) *GrpcClient
NewGrpcClient 创建Grpc客户端
type GrpcContextHandler ¶
GrpcContextHandler ...
type GrpcServer ¶
type GrpcServer struct {
// contains filtered or unexported fields
}
GrpcServer 服务端
func NewGrpcServer ¶
func NewGrpcServer(ctx context.Context, opts ...ServerOption) *GrpcServer
NewGrpcServer 创建Grpc服务端
func (*GrpcServer) Run ¶
func (s *GrpcServer) Run()
func (*GrpcServer) Start ¶
func (s *GrpcServer) Start()
func (*GrpcServer) Stop ¶
func (s *GrpcServer) Stop()
type Logger ¶ added in v2.2.0
type Logger interface { Debugf(ctx context.Context, format string, args ...interface{}) Debugln(ctx context.Context, args ...interface{}) Infof(ctx context.Context, format string, args ...interface{}) Infoln(ctx context.Context, args ...interface{}) Warnf(ctx context.Context, format string, args ...interface{}) Warnln(ctx context.Context, args ...interface{}) Errorf(ctx context.Context, format string, args ...interface{}) Errorln(ctx context.Context, args ...interface{}) Fatalf(ctx context.Context, format string, args ...interface{}) Fatalln(ctx context.Context, args ...interface{}) }
Logger logger
type ServerOption ¶ added in v2.2.0
type ServerOption func(*ServerOptions)
ServerOption 为可选参数赋值的函数
func WithServerAddress ¶ added in v2.2.0
func WithServerAddress(address string) ServerOption
func WithServerLogger ¶ added in v2.2.0
func WithServerLogger(log Logger) ServerOption
func WithServerName ¶ added in v2.2.0
func WithServerName(name string) ServerOption
func WithServerRandomPort ¶ added in v2.2.0
func WithServerRandomPort(randomPort bool) ServerOption
func WithServerRegister ¶ added in v2.2.0
func WithServerRegister(register resolver.Registry) ServerOption
func WithServerStreamServerInterceptors ¶ added in v2.2.0
func WithServerStreamServerInterceptors(streamServerInterceptors ...grpc.StreamServerInterceptor) ServerOption
func WithServerUnaryServerInterceptors ¶ added in v2.2.0
func WithServerUnaryServerInterceptors(unaryServerInterceptors ...grpc.UnaryServerInterceptor) ServerOption
type ServerOptions ¶ added in v2.2.0
type ServerOptions struct { Name string Address string Log Logger StreamServerInterceptors []grpc.StreamServerInterceptor UnaryServerInterceptors []grpc.UnaryServerInterceptor RandomPort bool // contains filtered or unexported fields }
ServerOptions 可选参数列表
func NewServerOptions ¶ added in v2.2.0
func NewServerOptions(opts ...ServerOption) ServerOptions
NewServerOptions 创建可选参数
type StdLogger ¶ added in v2.2.0
type StdLogger struct { }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.