本文整理汇总了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)
}