本文整理匯總了Golang中github.com/youtube/vitess/go/vt/vtgate/vtgateconn.VTGateConn.SplitQuery方法的典型用法代碼示例。如果您正苦於以下問題:Golang VTGateConn.SplitQuery方法的具體用法?Golang VTGateConn.SplitQuery怎麽用?Golang VTGateConn.SplitQuery使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/youtube/vitess/go/vt/vtgate/vtgateconn.VTGateConn
的用法示例。
在下文中一共展示了VTGateConn.SplitQuery方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: testSplitQuery
func testSplitQuery(t *testing.T, conn *vtgateconn.VTGateConn) {
ctx := context.Background()
qsl, err := conn.SplitQuery(ctx, splitQueryRequest.Keyspace, splitQueryRequest.Query, splitQueryRequest.SplitCount)
if err != nil {
t.Fatalf("SplitQuery failed: %v", err)
}
if !reflect.DeepEqual(qsl, splitQueryResult.Splits) {
t.Errorf("SplitQuery returned worng result: got %v wanted %v", qsl, splitQueryResult.Splits)
}
}
示例2: testEchoSplitQuery
func testEchoSplitQuery(t *testing.T, conn *vtgateconn.VTGateConn) {
want := &pbg.SplitQueryResponse_Part{
Query: tproto.BoundQueryToProto3(echoPrefix+query+":split_column:123", bindVars),
KeyRangePart: &pbg.SplitQueryResponse_KeyRangePart{Keyspace: keyspace},
}
got, err := conn.SplitQuery(context.Background(), keyspace, echoPrefix+query, bindVars, "split_column", 123)
if err != nil {
t.Fatalf("SplitQuery error: %v", err)
}
// For some reason, proto.Equal() is calling them unequal even though no diffs
// are found.
gotstr, wantstr := got[0].String(), want.String()
if gotstr != wantstr {
t.Errorf("SplitQuery() = %v, want %v", gotstr, wantstr)
}
}
示例3: testSplitQueryPanic
func testSplitQueryPanic(t *testing.T, conn *vtgateconn.VTGateConn) {
ctx := context.Background()
_, err := conn.SplitQuery(ctx, splitQueryRequest.Keyspace, splitQueryRequest.Query, splitQueryRequest.SplitCount)
expectPanic(t, err)
}