本文整理匯總了Golang中github.com/youtube/vitess/go/vt/tabletserver/tabletconn.TabletConn.BeginExecute方法的典型用法代碼示例。如果您正苦於以下問題:Golang TabletConn.BeginExecute方法的具體用法?Golang TabletConn.BeginExecute怎麽用?Golang TabletConn.BeginExecute使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/youtube/vitess/go/vt/tabletserver/tabletconn.TabletConn
的用法示例。
在下文中一共展示了TabletConn.BeginExecute方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: testBeginExecutePanics
func testBeginExecutePanics(t *testing.T, conn tabletconn.TabletConn, f *FakeQueryService) {
t.Log("testBeginExecutePanics")
testPanicHelper(t, f, "BeginExecute", func(ctx context.Context) error {
_, _, err := conn.BeginExecute(ctx, TestTarget, ExecuteQuery, ExecuteBindVars)
return err
})
}
示例2: testBeginExecuteErrorInBegin
func testBeginExecuteErrorInBegin(t *testing.T, conn tabletconn.TabletConn, f *FakeQueryService) {
t.Log("testBeginExecuteErrorInBegin")
f.HasBeginError = true
testErrorHelper(t, f, "BeginExecute.Begin", func(ctx context.Context) error {
_, transactionID, err := conn.BeginExecute(ctx, TestTarget, ExecuteQuery, ExecuteBindVars)
if transactionID != 0 {
t.Errorf("Unexpected transactionID from BeginExecute: got %v wanted 0", transactionID)
}
return err
})
f.HasBeginError = false
}
示例3: testBeginExecuteErrorInExecute
func testBeginExecuteErrorInExecute(t *testing.T, conn tabletconn.TabletConn, f *FakeQueryService) {
t.Log("testBeginExecuteErrorInExecute")
f.HasError = true
testErrorHelper(t, f, "BeginExecute.Execute", func(ctx context.Context) error {
ctx = callerid.NewContext(ctx, TestCallerID, TestVTGateCallerID)
_, transactionID, err := conn.BeginExecute(ctx, TestTarget, ExecuteQuery, ExecuteBindVars)
if transactionID != BeginTransactionID {
t.Errorf("Unexpected transactionID from BeginExecute: got %v wanted %v", transactionID, BeginTransactionID)
}
return err
})
f.HasError = false
}
示例4: testBeginExecute
func testBeginExecute(t *testing.T, conn tabletconn.TabletConn, f *FakeQueryService) {
t.Log("testBeginExecute")
f.ExpectedTransactionID = BeginTransactionID
ctx := context.Background()
ctx = callerid.NewContext(ctx, TestCallerID, TestVTGateCallerID)
qr, transactionID, err := conn.BeginExecute(ctx, TestTarget, ExecuteQuery, ExecuteBindVars)
if err != nil {
t.Fatalf("BeginExecute failed: %v", err)
}
if transactionID != BeginTransactionID {
t.Errorf("Unexpected result from BeginExecute: got %v wanted %v", transactionID, BeginTransactionID)
}
if !reflect.DeepEqual(*qr, ExecuteQueryResult) {
t.Errorf("Unexpected result from BeginExecute: got %v wanted %v", qr, ExecuteQueryResult)
}
}