當前位置: 首頁>>代碼示例>>Golang>>正文


Golang VTGateConn.SplitQuery方法代碼示例

本文整理匯總了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)
	}
}
開發者ID:pranjal5215,項目名稱:vitess,代碼行數:10,代碼來源:client.go

示例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)
	}
}
開發者ID:richarwu,項目名稱:vitess,代碼行數:16,代碼來源:echo.go

示例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)
}
開發者ID:pranjal5215,項目名稱:vitess,代碼行數:5,代碼來源:client.go


注:本文中的github.com/youtube/vitess/go/vt/vtgate/vtgateconn.VTGateConn.SplitQuery方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。