本文整理汇总了Golang中github.com/youtube/vitess/go/vt/tabletserver/tabletconn.TabletConn.BeginExecuteBatch方法的典型用法代码示例。如果您正苦于以下问题:Golang TabletConn.BeginExecuteBatch方法的具体用法?Golang TabletConn.BeginExecuteBatch怎么用?Golang TabletConn.BeginExecuteBatch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/youtube/vitess/go/vt/tabletserver/tabletconn.TabletConn
的用法示例。
在下文中一共展示了TabletConn.BeginExecuteBatch方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: testBeginExecuteBatchPanics
func testBeginExecuteBatchPanics(t *testing.T, conn tabletconn.TabletConn, f *FakeQueryService) {
t.Log("testBeginExecuteBatchPanics")
testPanicHelper(t, f, "BeginExecuteBatch", func(ctx context.Context) error {
_, _, err := conn.BeginExecuteBatch(ctx, TestTarget, ExecuteBatchQueries, true)
return err
})
}
示例2: testBeginExecuteBatchErrorInBegin
func testBeginExecuteBatchErrorInBegin(t *testing.T, conn tabletconn.TabletConn, f *FakeQueryService) {
t.Log("testBeginExecuteBatchErrorInBegin")
f.HasBeginError = true
testErrorHelper(t, f, "BeginExecuteBatch.Begin", func(ctx context.Context) error {
_, transactionID, err := conn.BeginExecuteBatch(ctx, TestTarget, ExecuteBatchQueries, true)
if transactionID != 0 {
t.Errorf("Unexpected transactionID from BeginExecuteBatch: got %v wanted 0", transactionID)
}
return err
})
f.HasBeginError = false
}
示例3: testBeginExecuteBatchErrorInExecuteBatch
func testBeginExecuteBatchErrorInExecuteBatch(t *testing.T, conn tabletconn.TabletConn, f *FakeQueryService) {
t.Log("testBeginExecuteBatchErrorInExecuteBatch")
f.HasError = true
testErrorHelper(t, f, "BeginExecute.ExecuteBatch", func(ctx context.Context) error {
ctx = callerid.NewContext(ctx, TestCallerID, TestVTGateCallerID)
_, transactionID, err := conn.BeginExecuteBatch(ctx, TestTarget, ExecuteBatchQueries, true)
if transactionID != BeginTransactionID {
t.Errorf("Unexpected transactionID from BeginExecuteBatch: got %v wanted %v", transactionID, BeginTransactionID)
}
return err
})
f.HasError = false
}
示例4: testBeginExecuteBatch
func testBeginExecuteBatch(t *testing.T, conn tabletconn.TabletConn, f *FakeQueryService) {
t.Log("testBeginExecuteBatch")
f.ExpectedTransactionID = BeginTransactionID
ctx := context.Background()
ctx = callerid.NewContext(ctx, TestCallerID, TestVTGateCallerID)
qrl, transactionID, err := conn.BeginExecuteBatch(ctx, TestTarget, ExecuteBatchQueries, true)
if err != nil {
t.Fatalf("BeginExecuteBatch failed: %v", err)
}
if transactionID != BeginTransactionID {
t.Errorf("Unexpected result from BeginExecuteBatch: got %v wanted %v", transactionID, BeginTransactionID)
}
if !reflect.DeepEqual(qrl, ExecuteBatchQueryResultList) {
t.Errorf("Unexpected result from ExecuteBatch: got %v wanted %v", qrl, ExecuteBatchQueryResultList)
}
}