Documentation ¶
Index ¶
- func RegisterDialOption(name string, f func(configuration *conf.Configuration) grpc.DialOption)
- func RegisterGrpcServerOption(name string, handler ServerOptionFunc)
- func RegisterGrpcStreamInterceptor(name string, handler StreamServerInterceptorFunc)
- func RegisterGrpcUnaryInterceptor(name string, handler UnaryServerInterceptorFunc)
- func RegisterStreamClientInterceptor(name string, ...)
- func RegisterUnaryClientInterceptor(name string, ...)
- type Client
- type DialOptionFunc
- type Option
- type Server
- type ServerConfig
- type ServerOptionFunc
- type StreamClientInterceptorFunc
- type StreamServerInterceptorFunc
- type UnaryClientInterceptorFunc
- type UnaryServerInterceptorFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterDialOption ¶ added in v0.2.0
func RegisterDialOption(name string, f func(configuration *conf.Configuration) grpc.DialOption)
RegisterDialOption register grpc dial option on client side
func RegisterGrpcServerOption ¶
func RegisterGrpcServerOption(name string, handler ServerOptionFunc)
RegisterGrpcServerOption register grpc server option
func RegisterGrpcStreamInterceptor ¶ added in v0.0.3
func RegisterGrpcStreamInterceptor(name string, handler StreamServerInterceptorFunc)
RegisterGrpcStreamInterceptor register grpc stream interceptor
func RegisterGrpcUnaryInterceptor ¶
func RegisterGrpcUnaryInterceptor(name string, handler UnaryServerInterceptorFunc)
RegisterGrpcUnaryInterceptor register grpc unary interceptor
func RegisterStreamClientInterceptor ¶ added in v0.2.0
func RegisterStreamClientInterceptor(name string, f func(configuration *conf.Configuration) grpc.StreamClientInterceptor)
RegisterStreamClientInterceptor register grpc stream client interceptor
func RegisterUnaryClientInterceptor ¶ added in v0.2.0
func RegisterUnaryClientInterceptor(name string, f func(configuration *conf.Configuration) grpc.UnaryClientInterceptor)
RegisterUnaryClientInterceptor register grpc unary client interceptor
Types ¶
type Client ¶ added in v0.2.0
type Client struct {
// contains filtered or unexported fields
}
Client is a grpc client helper,build a grpc client connection by configuration with registry. the configuration is like this:
server: for grpc server info registry: for registry center info client: for grpc client info target: for grpc service info using with registry or dial directly
func (*Client) Dial ¶ added in v0.2.0
func (c *Client) Dial(target string, opts ...grpc.DialOption) (*grpc.ClientConn, error)
Dial creates a gRPC client connection with the given target, and covert to DialContext if client.timeout > 0
func (*Client) DialContext ¶ added in v0.2.0
func (c *Client) DialContext(ctx context.Context, target string, opts ...grpc.DialOption) (*grpc.ClientConn, error)
DialContext creates a gRPC client connection with the given target.
The target will be parsed as a URL.your resolver must parse the target.
type DialOptionFunc ¶ added in v0.2.0
type DialOptionFunc func(*conf.Configuration) grpc.DialOption
client side
type Option ¶
type Option func(s *serverOptions)
func WithConfiguration ¶ added in v0.0.3
func WithConfiguration(cfg *conf.Configuration) Option
func WithGracefulStop ¶ added in v0.1.0
func WithGracefulStop() Option
WithGracefulStop indicate use graceful stop
func WithGrpcLogger ¶ added in v0.2.0
func WithGrpcLogger() Option
WithGrpcLogger set grpclog.LoggerV2 with the component logger named "grpc". if you need to see grpc log, you should call this option.
notice: call this while go test may cause race condition.
func WithGrpcOption ¶
func WithGrpcOption(opts ...grpc.ServerOption) Option
func WithListener ¶ added in v0.5.1
WithListener indicate use listener. if set listener, it will ignore the address setting.
type Server ¶
type Server struct { // ServiceInfos is for service discovery, it converts from grpc service info ServiceInfos []*registry.ServiceInfo // contains filtered or unexported fields }
Server is extended the native grpc server
func (*Server) Apply ¶
func (s *Server) Apply(cfg *conf.Configuration) error
Apply the configuration to the server.
func (*Server) ListenAndServe ¶ added in v0.0.3
ListenAndServe call net listen to start grpc server and registry service
type ServerConfig ¶
type ServerOptionFunc ¶ added in v0.2.0
type ServerOptionFunc func(*conf.Configuration) grpc.ServerOption
server side
type StreamClientInterceptorFunc ¶ added in v0.2.0
type StreamClientInterceptorFunc func(*conf.Configuration) grpc.StreamClientInterceptor
type StreamServerInterceptorFunc ¶ added in v0.2.0
type StreamServerInterceptorFunc func(*conf.Configuration) grpc.StreamServerInterceptor
type UnaryClientInterceptorFunc ¶ added in v0.2.0
type UnaryClientInterceptorFunc func(*conf.Configuration) grpc.UnaryClientInterceptor
type UnaryServerInterceptorFunc ¶ added in v0.2.0
type UnaryServerInterceptorFunc func(*conf.Configuration) grpc.UnaryServerInterceptor