Documentation ¶
Index ¶
- func LocalIPv4(name ...string) (ipAddr string, err error)
- func StreamServerInterceptor(f GrpcContextHandler) grpc.StreamServerInterceptor
- func UnaryServerInterceptor(f GrpcContextHandler) grpc.UnaryServerInterceptor
- type ClientOptionFunc
- func WithClientAddress(addr string) ClientOptionFunc
- func WithClientDiscovery(discovery resolver.Discovery) ClientOptionFunc
- func WithClientLogger(log ILogger) ClientOptionFunc
- func WithClientName(name string) ClientOptionFunc
- func WithStreamClientInterceptors(streamClientInterceptors ...grpc.StreamClientInterceptor) ClientOptionFunc
- func WithUnaryClientInterceptors(unaryClientInterceptors ...grpc.UnaryClientInterceptor) ClientOptionFunc
- type ClientOptions
- type GrpcClient
- type GrpcContextHandler
- type GrpcServer
- type ILogger
- type Logger
- func (l *Logger) Debugf(ctx context.Context, format string, args ...interface{})
- func (l *Logger) Debugln(ctx context.Context, args ...interface{})
- func (l *Logger) Errorf(ctx context.Context, format string, args ...interface{})
- func (l *Logger) Errorln(ctx context.Context, args ...interface{})
- func (l *Logger) Fatalf(ctx context.Context, format string, args ...interface{})
- func (l *Logger) Fatalln(ctx context.Context, args ...interface{})
- func (l *Logger) Infof(ctx context.Context, format string, args ...interface{})
- func (l *Logger) Infoln(ctx context.Context, args ...interface{})
- func (l *Logger) Warnf(ctx context.Context, format string, args ...interface{})
- func (l *Logger) Warnln(ctx context.Context, args ...interface{})
- type ServerOptionFunc
- func WithServerAddress(addr string) ServerOptionFunc
- func WithServerLogger(log ILogger) ServerOptionFunc
- func WithServerName(name string) ServerOptionFunc
- func WithServerRandomPort(randomPort bool) ServerOptionFunc
- func WithServerRegister(registry resolver.Registry) ServerOptionFunc
- func WithStreamServerInterceptor(streamServerInterceptors ...grpc.StreamServerInterceptor) ServerOptionFunc
- func WithUnaryServerInterceptor(unaryServerInterceptors ...grpc.UnaryServerInterceptor) ServerOptionFunc
- type ServerOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func StreamServerInterceptor ¶
func StreamServerInterceptor(f GrpcContextHandler) grpc.StreamServerInterceptor
func UnaryServerInterceptor ¶
func UnaryServerInterceptor(f GrpcContextHandler) grpc.UnaryServerInterceptor
Types ¶
type ClientOptionFunc ¶
type ClientOptionFunc func(o *ClientOptions)
func WithClientAddress ¶
func WithClientAddress(addr string) ClientOptionFunc
func WithClientDiscovery ¶
func WithClientDiscovery(discovery resolver.Discovery) ClientOptionFunc
func WithClientLogger ¶
func WithClientLogger(log ILogger) ClientOptionFunc
func WithClientName ¶
func WithClientName(name string) ClientOptionFunc
func WithStreamClientInterceptors ¶
func WithStreamClientInterceptors(streamClientInterceptors ...grpc.StreamClientInterceptor) ClientOptionFunc
func WithUnaryClientInterceptors ¶
func WithUnaryClientInterceptors(unaryClientInterceptors ...grpc.UnaryClientInterceptor) ClientOptionFunc
type ClientOptions ¶
type ClientOptions struct { Name string Address string Log ILogger StreamClientInterceptors []grpc.StreamClientInterceptor UnaryClientInterceptors []grpc.UnaryClientInterceptor // contains filtered or unexported fields }
func NewClientOptions ¶
func NewClientOptions(opts ...ClientOptionFunc) ClientOptions
type GrpcClient ¶
type GrpcClient struct {
// contains filtered or unexported fields
}
func NewGrpcClient ¶
func NewGrpcClient(ctx context.Context, opts ...ClientOptionFunc) *GrpcClient
func (*GrpcClient) Close ¶
func (c *GrpcClient) Close(ctx context.Context)
func (*GrpcClient) GetConn ¶
func (c *GrpcClient) GetConn() *grpc.ClientConn
type GrpcServer ¶
type GrpcServer struct {
// contains filtered or unexported fields
}
func NewGrpcServer ¶
func NewGrpcServer(ctx context.Context, opts ...ServerOptionFunc) *GrpcServer
func (*GrpcServer) Get ¶
func (s *GrpcServer) Get() *grpc.Server
func (*GrpcServer) Run ¶
func (s *GrpcServer) Run()
func (*GrpcServer) Start ¶
func (s *GrpcServer) Start()
func (*GrpcServer) Stop ¶
func (s *GrpcServer) Stop()
type ILogger ¶
type ILogger 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{}) }
type Logger ¶
type Logger struct { }
type ServerOptionFunc ¶
type ServerOptionFunc func(o *ServerOptions)
func WithServerAddress ¶
func WithServerAddress(addr string) ServerOptionFunc
func WithServerLogger ¶
func WithServerLogger(log ILogger) ServerOptionFunc
func WithServerName ¶
func WithServerName(name string) ServerOptionFunc
func WithServerRandomPort ¶
func WithServerRandomPort(randomPort bool) ServerOptionFunc
func WithServerRegister ¶
func WithServerRegister(registry resolver.Registry) ServerOptionFunc
func WithStreamServerInterceptor ¶
func WithStreamServerInterceptor(streamServerInterceptors ...grpc.StreamServerInterceptor) ServerOptionFunc
func WithUnaryServerInterceptor ¶
func WithUnaryServerInterceptor(unaryServerInterceptors ...grpc.UnaryServerInterceptor) ServerOptionFunc
type ServerOptions ¶
type ServerOptions struct { Name string Address string Log ILogger StreamServerInterceptors []grpc.StreamServerInterceptor UnaryServerInterceptor []grpc.UnaryServerInterceptor RandomPort bool // contains filtered or unexported fields }
func NewServerOptions ¶
func NewServerOptions(opts ...ServerOptionFunc) ServerOptions
Source Files ¶
Click to show internal directories.
Click to hide internal directories.