Documentation ¶
Index ¶
- func InitLogger()
- func WithStreamClientInterceptors(interceptors ...grpc.StreamClientInterceptor) grpc.DialOption
- func WithStreamServerInterceptors(interceptors ...grpc.StreamServerInterceptor) grpc.ServerOption
- func WithUnaryClientInterceptors(interceptors ...grpc.UnaryClientInterceptor) grpc.DialOption
- func WithUnaryServerInterceptors(interceptors ...grpc.UnaryServerInterceptor) grpc.ServerOption
- type Client
- type ClientOption
- func WithDialOption(opt grpc.DialOption) ClientOption
- func WithNonBlock() ClientOption
- func WithTimeout(timeout time.Duration) ClientOption
- func WithTransportCredentials(creds credentials.TransportCredentials) ClientOption
- func WithUnaryClientInterceptor(interceptor grpc.UnaryClientInterceptor) ClientOption
- type ClientOptions
- type Logger
- func (l *Logger) Error(args ...interface{})
- func (l *Logger) Errorf(format string, args ...interface{})
- func (l *Logger) Errorln(args ...interface{})
- func (l *Logger) Fatal(args ...interface{})
- func (l *Logger) Fatalf(format string, args ...interface{})
- func (l *Logger) Fatalln(args ...interface{})
- func (l *Logger) Info(args ...interface{})
- func (l *Logger) Infof(format string, args ...interface{})
- func (l *Logger) Infoln(args ...interface{})
- func (l *Logger) V(v int) bool
- func (l *Logger) Warning(args ...interface{})
- func (l *Logger) Warningf(format string, args ...interface{})
- func (l *Logger) Warningln(args ...interface{})
- type RegisterFn
- type Server
- type ServerOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithStreamClientInterceptors ¶
func WithStreamClientInterceptors(interceptors ...grpc.StreamClientInterceptor) grpc.DialOption
WithStreamClientInterceptors uses given client stream interceptors.
func WithStreamServerInterceptors ¶
func WithStreamServerInterceptors(interceptors ...grpc.StreamServerInterceptor) grpc.ServerOption
WithStreamServerInterceptors uses given server stream interceptors.
func WithUnaryClientInterceptors ¶
func WithUnaryClientInterceptors(interceptors ...grpc.UnaryClientInterceptor) grpc.DialOption
WithUnaryClientInterceptors uses given client unary interceptors.
func WithUnaryServerInterceptors ¶
func WithUnaryServerInterceptors(interceptors ...grpc.UnaryServerInterceptor) grpc.ServerOption
WithUnaryServerInterceptors uses given server unary interceptors.
Types ¶
type Client ¶ added in v1.1.5
type Client interface {
Conn() *grpc.ClientConn
}
Client interface wraps the Conn method.
type ClientOption ¶
type ClientOption func(options *ClientOptions)
ClientOption defines the method to customize a ClientOptions.
func WithDialOption ¶
func WithDialOption(opt grpc.DialOption) ClientOption
WithDialOption returns a func to customize a ClientOptions with given dial option.
func WithNonBlock ¶ added in v1.2.3
func WithNonBlock() ClientOption
WithNonBlock sets the dialing to be nonblock.
func WithTimeout ¶
func WithTimeout(timeout time.Duration) ClientOption
WithTimeout returns a func to customize a ClientOptions with given timeout.
func WithTransportCredentials ¶ added in v1.2.3
func WithTransportCredentials(creds credentials.TransportCredentials) ClientOption
WithTransportCredentials return a func to make the gRPC calls secured with given credentials.
func WithUnaryClientInterceptor ¶ added in v1.0.22
func WithUnaryClientInterceptor(interceptor grpc.UnaryClientInterceptor) ClientOption
WithUnaryClientInterceptor returns a func to customize a ClientOptions with given interceptor.
type ClientOptions ¶
type ClientOptions struct { NonBlock bool Timeout time.Duration Secure bool DialOptions []grpc.DialOption }
A ClientOptions is a client options.
type Logger ¶
type Logger struct{}
A Logger is a rpc logger.
func (*Logger) Error ¶
func (l *Logger) Error(args ...interface{})
Error logs the given args into error log.
func (*Logger) Errorln ¶
func (l *Logger) Errorln(args ...interface{})
Errorln logs the given args into error log with newline.
func (*Logger) Fatal ¶
func (l *Logger) Fatal(args ...interface{})
Fatal logs the given args into error log.
func (*Logger) Fatalln ¶
func (l *Logger) Fatalln(args ...interface{})
Fatalln logs args into error log with newline.
func (*Logger) Infoln ¶
func (l *Logger) Infoln(args ...interface{})
Infoln ignores the grpc info logs.
func (*Logger) Warning ¶
func (l *Logger) Warning(args ...interface{})
Warning ignores the grpc warning logs.
type RegisterFn ¶
RegisterFn defines the method to register a server.
type Server ¶
type Server interface { AddOptions(options ...grpc.ServerOption) AddStreamInterceptors(interceptors ...grpc.StreamServerInterceptor) AddUnaryInterceptors(interceptors ...grpc.UnaryServerInterceptor) SetName(string) Start(register RegisterFn) error }
Server interface represents a rpc server.
func NewRpcPubServer ¶
NewRpcPubServer returns a Server.
func NewRpcServer ¶
func NewRpcServer(address string, opts ...ServerOption) Server
NewRpcServer returns a Server.
type ServerOption ¶
type ServerOption func(options *rpcServerOptions)
ServerOption defines the method to customize a rpcServerOptions.
func WithMetrics ¶
func WithMetrics(metrics *stat.Metrics) ServerOption
WithMetrics returns a func that sets metrics to a Server.