本文整理汇总了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
}
示例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)
}
示例3: init
func init() {
vtgateconn.RegisterDialer("grpc", dial)
}