本文整理匯總了Golang中github.com/youtube/vitess/go/vt/vtgate/vtgateconn.VTGateConn.GetSrvKeyspace方法的典型用法代碼示例。如果您正苦於以下問題:Golang VTGateConn.GetSrvKeyspace方法的具體用法?Golang VTGateConn.GetSrvKeyspace怎麽用?Golang VTGateConn.GetSrvKeyspace使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/youtube/vitess/go/vt/vtgate/vtgateconn.VTGateConn
的用法示例。
在下文中一共展示了VTGateConn.GetSrvKeyspace方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: testGetSrvKeyspace
func testGetSrvKeyspace(t *testing.T, conn *vtgateconn.VTGateConn) {
want := &topodatapb.SrvKeyspace{
Partitions: []*topodatapb.SrvKeyspace_KeyspacePartition{
&topodatapb.SrvKeyspace_KeyspacePartition{
ServedType: topodatapb.TabletType_REPLICA,
ShardReferences: []*topodatapb.ShardReference{
&topodatapb.ShardReference{
Name: "shard0",
KeyRange: &topodatapb.KeyRange{
Start: []byte{0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
End: []byte{0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
},
},
},
},
},
ShardingColumnName: "sharding_column_name",
ShardingColumnType: topodatapb.KeyspaceIdType_UINT64,
ServedFrom: []*topodatapb.SrvKeyspace_ServedFrom{
&topodatapb.SrvKeyspace_ServedFrom{
TabletType: topodatapb.TabletType_MASTER,
Keyspace: "other_keyspace",
},
},
SplitShardCount: 128,
}
got, err := conn.GetSrvKeyspace(context.Background(), "big")
if err != nil {
t.Fatalf("GetSrvKeyspace error: %v", err)
}
if !proto.Equal(got, want) {
t.Errorf("GetSrvKeyspace() = %v, want %v", proto.MarshalTextString(got), proto.MarshalTextString(want))
}
}