Documentation ¶
Index ¶
- func Dial(ctx context.Context, opts ...ClientOption) (*grpc.ClientConn, error)
- func DialInsecure(ctx context.Context, opts ...ClientOption) (*grpc.ClientConn, error)
- func NewClientContext(ctx context.Context, info ClientInfo) context.Context
- func NewServerContext(ctx context.Context, info ServerInfo) context.Context
- func UnaryClientInterceptor(m middleware.Middleware) grpc.UnaryClientInterceptor
- func UnaryServerInterceptor(m middleware.Middleware) grpc.UnaryServerInterceptor
- func UnaryTimeoutInterceptor(timeout time.Duration) grpc.UnaryServerInterceptor
- type ClientInfo
- type ClientOption
- type Server
- type ServerInfo
- type ServerOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Dial ¶
func Dial(ctx context.Context, opts ...ClientOption) (*grpc.ClientConn, error)
Dial returns a GRPC connection.
func DialInsecure ¶
func DialInsecure(ctx context.Context, opts ...ClientOption) (*grpc.ClientConn, error)
DialInsecure returns an insecure GRPC connection.
func NewClientContext ¶
func NewClientContext(ctx context.Context, info ClientInfo) context.Context
NewClientContext returns a new Context that carries value.
func NewServerContext ¶
func NewServerContext(ctx context.Context, info ServerInfo) context.Context
NewServerContext returns a new Context that carries value.
func UnaryClientInterceptor ¶
func UnaryClientInterceptor(m middleware.Middleware) grpc.UnaryClientInterceptor
UnaryClientInterceptor retruns a unary client interceptor.
func UnaryServerInterceptor ¶
func UnaryServerInterceptor(m middleware.Middleware) grpc.UnaryServerInterceptor
UnaryServerInterceptor returns a unary server interceptor.
func UnaryTimeoutInterceptor ¶
func UnaryTimeoutInterceptor(timeout time.Duration) grpc.UnaryServerInterceptor
UnaryTimeoutInterceptor returns a unary timeout interceptor.
Types ¶
type ClientInfo ¶
type ClientInfo struct { // FullMethod is the full RPC method string, i.e., /package.service/method. FullMethod string }
ClientInfo is gRPC server infomation.
func FromClientContext ¶
func FromClientContext(ctx context.Context) (info ClientInfo, ok bool)
FromClientContext returns the Transport value stored in ctx, if any.
type ClientOption ¶
type ClientOption func(o *clientOptions)
ClientOption is gRPC client option.
func WithEndpoint ¶
func WithEndpoint(endpoint string) ClientOption
WithEndpoint with client endpoint.
func WithMiddleware ¶
func WithMiddleware(m middleware.Middleware) ClientOption
WithMiddleware with client middleware.
func WithOptions ¶
func WithOptions(opts ...grpc.DialOption) ClientOption
WithOptions with gRPC options.
func WithRegistry ¶
func WithRegistry(r registry.Registry) ClientOption
WithRegistry with client registry.
func WithTimeout ¶
func WithTimeout(timeout time.Duration) ClientOption
WithTimeout with client timeout.
type Server ¶
Server is a gRPC server wrapper.
func NewServer ¶
func NewServer(opts ...ServerOption) *Server
NewServer creates a gRPC server by options.
type ServerInfo ¶
type ServerInfo struct { // Server is the service implementation the user provides. This is read-only. Server interface{} // FullMethod is the full RPC method string, i.e., /package.service/method. FullMethod string }
ServerInfo is gRPC server infomation.
func FromServerContext ¶
func FromServerContext(ctx context.Context) (info ServerInfo, ok bool)
FromServerContext returns the Transport value stored in ctx, if any.
type ServerOption ¶
type ServerOption func(o *Server)
ServerOption is gRPC server option.
func Middleware ¶
func Middleware(m middleware.Middleware) ServerOption
Middleware with server middleware.