本文整理匯總了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)
}