Documentation ¶
Index ¶
- Constants
- 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
- type ClientInfo
- type ClientOption
- type Server
- type ServerInfo
- type ServerOption
Constants ¶
const (
KindGRPC transport.Kind = "gRPC"
)
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.
Types ¶
type ClientInfo ¶
type ClientInfo struct { // FullMethod is the full RPC method string, i.e., /package.service/method. FullMethod string }
ClientInfo represent gRPC server information.
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 WithDiscovery ¶
func WithDiscovery(d registry.Discovery) ClientOption
WithDiscovery with client discovery.
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 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 represent gRPC server information.
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(s *Server)
ServerOption is gRPC server option.
func Middleware ¶
func Middleware(m middleware.Middleware) ServerOption
Middleware with server middleware.