func testSubDump(t *testing.T, c *client.Conn) { ch, wa := c.SubDump([]byte("hest")) ch <- [2][]byte{[]byte("testSubDumpk1"), []byte("testSubDumpv1")} ch <- [2][]byte{[]byte("testSubDumpk2"), []byte("testSubDumpv2")} close(ch) wa.Wait() if val, ex := c.SubGet([]byte("hest"), []byte("testSubDumpk1")); !ex || bytes.Compare(val, []byte("testSubDumpv1")) != 0 { t.Errorf("wrong value") } if val, ex := c.SubGet([]byte("hest"), []byte("testSubDumpk2")); !ex || bytes.Compare(val, []byte("testSubDumpv2")) != 0 { t.Errorf("wrong value") } }
func subGet(conn *client.Conn, args []string) { if value, existed := conn.SubGet([]byte(args[1]), []byte(args[2])); existed { fmt.Printf("%v\n", decode(value)) } }