本文整理汇总了Golang中github.com/youtube/vitess/go/vt/proto/queryservice.Query_StreamExecuteServer类的典型用法代码示例。如果您正苦于以下问题:Golang Query_StreamExecuteServer类的具体用法?Golang Query_StreamExecuteServer怎么用?Golang Query_StreamExecuteServer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Query_StreamExecuteServer类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: StreamExecute
// StreamExecute is part of the queryservice.QueryServer interface
func (q *query) StreamExecute(request *pb.StreamExecuteRequest, stream pbs.Query_StreamExecuteServer) (err error) {
defer q.server.HandlePanic(&err)
ctx := callerid.NewContext(callinfo.GRPCCallInfo(stream.Context()),
request.EffectiveCallerId,
request.ImmediateCallerId,
)
bv, err := proto.Proto3ToBindVariables(request.Query.BindVariables)
if err != nil {
return tabletserver.ToGRPCError(err)
}
if err := q.server.StreamExecute(ctx, request.Target, &proto.Query{
Sql: request.Query.Sql,
BindVariables: bv,
SessionId: request.SessionId,
}, func(reply *mproto.QueryResult) error {
result, err := mproto.QueryResultToProto3(reply)
if err != nil {
return err
}
return stream.Send(&pb.StreamExecuteResponse{Result: result})
}); err != nil {
return tabletserver.ToGRPCError(err)
}
return nil
}
开发者ID:khanchan,项目名称:vitess,代码行数:26,代码来源:server.go
示例2: StreamExecute
// StreamExecute is part of the queryservice.QueryServer interface
func (q *query) StreamExecute(request *pb.StreamExecuteRequest, stream pbs.Query_StreamExecuteServer) (err error) {
defer q.server.HandlePanic(&err)
ctx := callerid.NewContext(callinfo.GRPCCallInfo(stream.Context()),
request.EffectiveCallerId,
request.ImmediateCallerId,
)
return q.server.StreamExecute(ctx, request.Target, &proto.Query{
Sql: string(request.Query.Sql),
BindVariables: proto.Proto3ToBindVariables(request.Query.BindVariables),
SessionId: request.SessionId,
}, func(reply *mproto.QueryResult) error {
return stream.Send(&pb.StreamExecuteResponse{
Result: mproto.QueryResultToProto3(reply),
})
})
}
开发者ID:haoqoo,项目名称:vitess,代码行数:17,代码来源:server.go
示例3: StreamExecute
// StreamExecute is part of the queryservice.QueryServer interface
func (q *query) StreamExecute(request *querypb.StreamExecuteRequest, stream queryservicepb.Query_StreamExecuteServer) (err error) {
defer q.server.HandlePanic(&err)
ctx := callerid.NewContext(callinfo.GRPCCallInfo(stream.Context()),
request.EffectiveCallerId,
request.ImmediateCallerId,
)
bv, err := querytypes.Proto3ToBindVariables(request.Query.BindVariables)
if err != nil {
return tabletserver.ToGRPCError(err)
}
if err := q.server.StreamExecute(ctx, request.Target, request.Query.Sql, bv, request.SessionId, func(reply *sqltypes.Result) error {
return stream.Send(&querypb.StreamExecuteResponse{
Result: sqltypes.ResultToProto3(reply),
})
}); err != nil {
return tabletserver.ToGRPCError(err)
}
return nil
}
开发者ID:littleyang,项目名称:vitess,代码行数:20,代码来源:server.go
示例4: StreamExecute
// StreamExecute is part of the queryservice.QueryServer interface
func (q *query) StreamExecute(request *pb.StreamExecuteRequest, stream pbs.Query_StreamExecuteServer) (err error) {
defer q.server.HandlePanic(&err)
ctx := callerid.NewContext(callinfo.GRPCCallInfo(stream.Context()),
request.GetEffectiveCallerId(),
request.GetImmediateCallerId(),
)
seErr := q.server.StreamExecute(ctx, &proto.Query{
Sql: string(request.Query.Sql),
BindVariables: proto.Proto3ToBindVariables(request.Query.BindVariables),
SessionId: request.SessionId,
}, func(reply *mproto.QueryResult) error {
return stream.Send(&pb.StreamExecuteResponse{
Result: mproto.QueryResultToProto3(reply),
})
})
if seErr != nil {
response := &pb.StreamExecuteResponse{
Error: tabletserver.TabletErrorToRPCError(seErr),
}
if err := stream.Send(response); err != nil {
return err
}
}
return nil
}
开发者ID:afrolovskiy,项目名称:vitess,代码行数:26,代码来源:server.go
注:本文中的github.com/youtube/vitess/go/vt/proto/queryservice.Query_StreamExecuteServer类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论