3 Star 9 Fork 3

Gitee 极速下载 / grpc-gateway

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
此仓库是为了提升国内下载速度的镜像仓库,每日同步一次。 原始仓库: https://github.com/grpc-ecosystem/grpc-gateway
克隆/下载
flow_combination.go 2.17 KB
一键复制 编辑 原始数据 按行查看 历史
package server
import (
"io"
examples "github.com/grpc-ecosystem/grpc-gateway/examples/examplepb"
"golang.org/x/net/context"
)
type flowCombinationServer struct{}
func newFlowCombinationServer() examples.FlowCombinationServer {
return &flowCombinationServer{}
}
func (s flowCombinationServer) RpcEmptyRpc(ctx context.Context, req *examples.EmptyProto) (*examples.EmptyProto, error) {
return req, nil
}
func (s flowCombinationServer) RpcEmptyStream(req *examples.EmptyProto, stream examples.FlowCombination_RpcEmptyStreamServer) error {
return stream.Send(req)
}
func (s flowCombinationServer) StreamEmptyRpc(stream examples.FlowCombination_StreamEmptyRpcServer) error {
for {
_, err := stream.Recv()
if err == io.EOF {
break
}
if err != nil {
return err
}
}
return stream.SendAndClose(new(examples.EmptyProto))
}
func (s flowCombinationServer) StreamEmptyStream(stream examples.FlowCombination_StreamEmptyStreamServer) error {
for {
_, err := stream.Recv()
if err == io.EOF {
break
}
if err != nil {
return err
}
}
return stream.Send(new(examples.EmptyProto))
}
func (s flowCombinationServer) RpcBodyRpc(ctx context.Context, req *examples.NonEmptyProto) (*examples.EmptyProto, error) {
return new(examples.EmptyProto), nil
}
func (s flowCombinationServer) RpcPathSingleNestedRpc(ctx context.Context, req *examples.SingleNestedProto) (*examples.EmptyProto, error) {
return new(examples.EmptyProto), nil
}
func (s flowCombinationServer) RpcPathNestedRpc(ctx context.Context, req *examples.NestedProto) (*examples.EmptyProto, error) {
return new(examples.EmptyProto), nil
}
func (s flowCombinationServer) RpcBodyStream(req *examples.NonEmptyProto, stream examples.FlowCombination_RpcBodyStreamServer) error {
return stream.Send(new(examples.EmptyProto))
}
func (s flowCombinationServer) RpcPathSingleNestedStream(req *examples.SingleNestedProto, stream examples.FlowCombination_RpcPathSingleNestedStreamServer) error {
return stream.Send(new(examples.EmptyProto))
}
func (s flowCombinationServer) RpcPathNestedStream(req *examples.NestedProto, stream examples.FlowCombination_RpcPathNestedStreamServer) error {
return stream.Send(new(examples.EmptyProto))
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/mirrors/grpc-gateway.git
git@gitee.com:mirrors/grpc-gateway.git
mirrors
grpc-gateway
grpc-gateway
v1.3.1

搜索帮助

344bd9b3 5694891 D2dac590 5694891