Documentation ¶
Index ¶
Constants ¶
View Source
const ( //SupportPackageIsVersion4 当前框架版本 SupportPackageIsVersion4 = true )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CallOptions ¶ added in v0.5.0
CallOptions 请求配置
type Client ¶
type Client interface { Invoke(ctx context.Context, md *MethodDesc, in interface{}, out interface{}, opts ...CallOption) error NewStream(ctx context.Context, sd *StreamDesc, opts ...CallOption) (ClientStream, error) }
Client 客户端接口
type ClientStream ¶
type ClientStream interface { SendMsg(m interface{}) error RecvMsg(m interface{}) error CloseSend() error }
ClientStream 流式客户端接口
type HttpRule ¶
type HttpRule interface { GetGet() string GetPut() string GetPost() string GetDelete() string GetPatch() string GetBody() string GetResponseBody() string }
HttpRule HTTP规则定义接口
type MethodDesc ¶ added in v0.4.0
type MethodDesc struct { Contract Contract ServiceName string MethodName string RequestType interface{} ResponseType interface{} HttpRule HttpRule }
MethodDesc 单次调用方法定义
type NameService ¶
type NameService interface { GetAddress(ctx context.Context, contract Contract) (string, error) GetAllAddresses(ctx context.Context, contract Contract) ([]string, error) }
NameService 名字服务接口
type Server ¶
type Server interface { RegisterUnaryEndpoint(md *MethodDesc, handle UnaryEndpoint) RegisterStreamEndpoint(sd *StreamDesc, handle StreamEndpoint) }
Server 服务端接口
type ServiceStream ¶
type ServiceStream interface { // TODO add support SetHeader() SendHeader() SetTrailer() SendMsg(m interface{}) error RecvMsg(m interface{}) error }
ServiceStream 流式服务接口
type StatusCode ¶ added in v0.4.0
StatusCode 统一状态码接口
type StreamDesc ¶ added in v0.4.0
type StreamDesc struct { Contract Contract ServiceName string StreamName string ClientStreams bool ServerStreams bool }
StreamDesc 流式调用方法定义
type StreamEndpoint ¶
type StreamEndpoint func(ctx context.Context, stream ServiceStream) error
StreamEndpoint 流式调用函数
type UnaryEndpoint ¶
UnaryEndpoint 单次调用函数
Click to show internal directories.
Click to hide internal directories.