当前位置: 首页>>代码示例>>Golang>>正文


Golang vtgateconn.RegisterDialer函数代码示例

本文整理汇总了Golang中github.com/youtube/vitess/go/vt/vtgate/vtgateconn.RegisterDialer函数的典型用法代码示例。如果您正苦于以下问题:Golang RegisterDialer函数的具体用法?Golang RegisterDialer怎么用?Golang RegisterDialer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了RegisterDialer函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: RegisterFakeVTGateConnDialer

// RegisterFakeVTGateConnDialer registers the proper dialer for this fake,
// and returns the underlying instance that will be returned by the dialer,
// and the protocol to use to get this fake.
func RegisterFakeVTGateConnDialer() (*FakeVTGateConn, string) {
	protocol := "fake"
	impl := &FakeVTGateConn{
		execMap:       make(map[string]*queryResponse),
		splitQueryMap: make(map[string]*splitQueryResponse),
	}
	vtgateconn.RegisterDialer(protocol, func(ctx context.Context, address string, timeout time.Duration) (vtgateconn.Impl, error) {
		return impl, nil
	})
	return impl, protocol
}
开发者ID:zhzhy917,项目名称:vitess,代码行数:14,代码来源:conn.go

示例2: TestSuite

// TestSuite runs all the tests
func TestSuite(t *testing.T, impl vtgateconn.Impl, fakeServer vtgateservice.VTGateService) {
	vtgateconn.RegisterDialer("test", func(ctx context.Context, address string, timeout time.Duration) (vtgateconn.Impl, error) {
		return impl, nil
	})
	conn, _ := vtgateconn.DialProtocol(context.Background(), "test", "", 0)

	testExecute(t, conn)
	testExecuteShard(t, conn)
	testExecuteKeyspaceIds(t, conn)
	testExecuteKeyRanges(t, conn)
	testExecuteEntityIds(t, conn)
	testExecuteBatchShard(t, conn)
	testExecuteBatchKeyspaceIds(t, conn)
	testStreamExecute(t, conn)
	testStreamExecuteShard(t, conn)
	testStreamExecuteKeyRanges(t, conn)
	testStreamExecuteKeyspaceIds(t, conn)
	testTxPass(t, conn)
	testTxPassNotInTransaction(t, conn)
	testTxFail(t, conn)
	testSplitQuery(t, conn)

	// force a panic at every call, then test that works
	fakeServer.(*fakeVTGateService).panics = true
	testExecutePanic(t, conn)
	testExecuteShardPanic(t, conn)
	testExecuteKeyspaceIdsPanic(t, conn)
	testExecuteKeyRangesPanic(t, conn)
	testExecuteEntityIdsPanic(t, conn)
	testExecuteBatchShardPanic(t, conn)
	testExecuteBatchKeyspaceIdsPanic(t, conn)
	testStreamExecutePanic(t, conn)
	testStreamExecuteShardPanic(t, conn)
	testStreamExecuteKeyRangesPanic(t, conn)
	testStreamExecuteKeyspaceIdsPanic(t, conn)
	testBeginPanic(t, conn)
	testSplitQueryPanic(t, conn)
}
开发者ID:pranjal5215,项目名称:vitess,代码行数:39,代码来源:client.go

示例3: init

func init() {
	vtgateconn.RegisterDialer("grpc", dial)
}
开发者ID:xgwubin,项目名称:vitess,代码行数:3,代码来源:conn.go


注:本文中的github.com/youtube/vitess/go/vt/vtgate/vtgateconn.RegisterDialer函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。