本文整理汇总了Golang中github.com/youtube/vitess/go/vt/binlog/binlogplayer.Client.StreamTables方法的典型用法代码示例。如果您正苦于以下问题:Golang Client.StreamTables方法的具体用法?Golang Client.StreamTables怎么用?Golang Client.StreamTables使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/youtube/vitess/go/vt/binlog/binlogplayer.Client
的用法示例。
在下文中一共展示了Client.StreamTables方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: testStreamTablesPanics
func testStreamTablesPanics(t *testing.T, bpc binlogplayer.Client) {
ctx := context.Background()
stream, err := bpc.StreamTables(ctx, testTablesRequest.Position, testTablesRequest.Tables, testTablesRequest.Charset)
if err != nil {
t.Fatalf("got error: %v", err)
}
if se, err := stream.Recv(); err == nil {
t.Fatalf("got a response when error expected: %v", se)
} else {
if !strings.Contains(err.Error(), "test-triggered panic") {
t.Errorf("wrong error from panic: %v", err)
}
}
}
示例2: testStreamTablesPanics
func testStreamTablesPanics(t *testing.T, bpc binlogplayer.Client) {
ctx := context.Background()
c, errFunc, err := bpc.StreamTables(ctx, testTablesRequest)
if err != nil {
t.Fatalf("got error: %v", err)
}
if se, ok := <-c; ok {
t.Fatalf("got a response when error expected: %v", se)
}
err = errFunc()
if err == nil || !strings.Contains(err.Error(), "test-triggered panic") {
t.Errorf("wrong error from panic: %v", err)
}
}
示例3: testStreamTables
func testStreamTables(t *testing.T, bpc binlogplayer.Client) {
ctx := context.Background()
stream, err := bpc.StreamTables(ctx, testTablesRequest.Position, testTablesRequest.Tables, testTablesRequest.Charset)
if err != nil {
t.Fatalf("got error: %v", err)
}
if se, err := stream.Recv(); err != nil {
t.Fatalf("got error: %v", err)
} else {
if !reflect.DeepEqual(*se, *testBinlogTransaction) {
t.Errorf("got wrong result, got %v expected %v", *se, *testBinlogTransaction)
}
}
if se, err := stream.Recv(); err == nil {
t.Fatalf("got a response when error expected: %v", se)
}
}
示例4: testStreamTables
func testStreamTables(t *testing.T, bpc binlogplayer.Client) {
ctx := context.Background()
c, errFunc, err := bpc.StreamTables(ctx, testTablesRequest)
if err != nil {
t.Fatalf("got error: %v", err)
}
if se, ok := <-c; !ok {
t.Fatalf("got no response")
} else {
if !reflect.DeepEqual(*se, *testBinlogTransaction) {
t.Errorf("got wrong result, got %v expected %v", *se, *testBinlogTransaction)
}
}
if se, ok := <-c; ok {
t.Fatalf("got a response when error expected: %v", se)
}
if err := errFunc(); err != nil {
t.Errorf("got unexpected error: %v", err)
}
}