本文整理汇总了Golang中github.com/youtube/vitess/go/vt/vtgate/proto.QueryResultList.Err方法的典型用法代码示例。如果您正苦于以下问题:Golang QueryResultList.Err方法的具体用法?Golang QueryResultList.Err怎么用?Golang QueryResultList.Err使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/youtube/vitess/go/vt/vtgate/proto.QueryResultList
的用法示例。
在下文中一共展示了QueryResultList.Err方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: ExecuteBatchKeyspaceIds
func (c *errorClient) ExecuteBatchKeyspaceIds(ctx context.Context, queries []proto.BoundKeyspaceIdQuery, tabletType pb.TabletType, asTransaction bool, session *proto.Session, reply *proto.QueryResultList) error {
if len(queries) == 1 {
if rpcErr := requestToPartialError(queries[0].Sql); rpcErr != nil {
reply.Err = rpcErr
reply.Error = rpcErr.Message
return nil
}
if err := requestToError(queries[0].Sql); err != nil {
return err
}
}
return c.fallbackClient.ExecuteBatchKeyspaceIds(ctx, queries, tabletType, asTransaction, session, reply)
}
示例2: ExecuteBatchKeyspaceIds
func (c *errorClient) ExecuteBatchKeyspaceIds(ctx context.Context, queries []*vtgatepb.BoundKeyspaceIdQuery, tabletType topodatapb.TabletType, asTransaction bool, session *vtgatepb.Session, reply *proto.QueryResultList) error {
if len(queries) == 1 {
var partialReply proto.QueryResult
if requestToPartialError(queries[0].Query.Sql, session, &partialReply) {
reply.Err = partialReply.Err
reply.Session = partialReply.Session
return nil
}
if err := requestToError(queries[0].Query.Sql); err != nil {
return err
}
}
return c.fallbackClient.ExecuteBatchKeyspaceIds(ctx, queries, tabletType, asTransaction, session, reply)
}
示例3: ExecuteBatchShards
// ExecuteBatchShards executes a group of queries on the specified shards.
func (vtg *VTGate) ExecuteBatchShards(ctx context.Context, queries []proto.BoundShardQuery, tabletType pb.TabletType, asTransaction bool, session *proto.Session, reply *proto.QueryResultList) error {
startTime := time.Now()
statsKey := []string{"ExecuteBatchShards", "", ""}
defer vtg.timings.Record(statsKey, startTime)
x := vtg.inFlight.Add(1)
defer vtg.inFlight.Add(-1)
if 0 < vtg.maxInFlight && vtg.maxInFlight < x {
return errTooManyInFlight
}
annotateBoundShardQueriesAsUnfriendly(queries)
qrs, err := vtg.resolver.ExecuteBatch(
ctx,
tabletType,
asTransaction,
session,
func() (*scatterBatchRequest, error) {
return boundShardQueriesToScatterBatchRequest(queries), nil
})
if err == nil {
reply.List = qrs.List
var rowCount int64
for _, qr := range qrs.List {
rowCount += int64(len(qr.Rows))
}
vtg.rowsReturned.Add(statsKey, rowCount)
} else {
query := map[string]interface{}{
"Queries": queries,
"TabletType": strings.ToLower(tabletType.String()),
"AsTransaction": asTransaction,
"Session": session,
}
reply.Error = handleExecuteError(err, statsKey, query, vtg.logExecuteBatchShards).Error()
reply.Err = vterrors.RPCErrFromVtError(err)
}
reply.Session = session
return nil
}
示例4: AddVtGateErrorToQueryResultList
// AddVtGateErrorToQueryResultList will mutate a QueryResultList struct to fill in the Err
// field with details from the VTGate error.
func AddVtGateErrorToQueryResultList(err error, reply *proto.QueryResultList) {
if err == nil {
return
}
reply.Err = rpcErrFromVtGateError(err)
}