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
- 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 返回GRPC连接.
func DialInsecure ¶
func DialInsecure(ctx context.Context, opts ...ClientOption) (*grpc.ClientConn, error)
DialInsecure 返回不安全的GRPC连接.
func NewClientContext ¶
func NewClientContext(ctx context.Context, info ClientInfo) context.Context
NewClientContext 返回一个带有值(ClientInfo)的新Context.
func NewServerContext ¶
func NewServerContext(ctx context.Context, info ServerInfo) context.Context
NewServerContext 返回一个带有值(ServerInfo)的新Context.
Types ¶
type ClientInfo ¶
type ClientInfo struct { // FullMethod 是完整的RPC方法字符串,即/package.service/method. FullMethod string }
ClientInfo 表示gRPC服务器信息.
func FromClientContext ¶
func FromClientContext(ctx context.Context) (info ClientInfo, ok bool)
FromClientContext 返回存储在ctx中的传输值(如果有).
type ClientOption ¶
type ClientOption func(o *clientOptions)
ClientOption 是gRPC客户端选项.
func WithMiddleware ¶
func WithMiddleware(m middleware.Middleware) ClientOption
WithMiddleware 带客户端中间件.
type Server ¶
Server 是一个gRPC服务器包装器.
type ServerInfo ¶
type ServerInfo struct { // Server 是用户提供的服务实现.这是只读的. Server interface{} // FullMethod 是完整的RPC方法字符串,即/package.service/method. FullMethod string }
ServerInfo 表示gRPC服务器信息.
func FromServerContext ¶
func FromServerContext(ctx context.Context) (info ServerInfo, ok bool)
FromServerContext 返回存储在ctx中的传输值(如果有).
Click to show internal directories.
Click to hide internal directories.