示例#1
0
文件: god_cli.go 项目: rhino1998/god
func dumpSetOp(conn *client.Conn, args []string) {
	op, err := setop.NewSetOpParser(args[2]).Parse()
	if err != nil {
		fmt.Println(err)
	} else {
		for _, res := range conn.SetExpression(setop.SetExpression{Dest: []byte(args[1]), Op: op}) {
			printSetOpRes(res)
		}
	}
}
示例#2
0
文件: god_cli.go 项目: rhino1998/god
func describeTree(conn *client.Conn, args []string) {
	if bytes, err := hex.DecodeString(args[1]); err != nil {
		fmt.Println(err)
	} else {
		if result, err := conn.DescribeTree(bytes); err != nil {
			fmt.Println(err)
		} else {
			fmt.Println(result)
		}
	}
}
示例#3
0
func testDump(t *testing.T, c *client.Conn) {
	ch, wa := c.Dump()
	ch <- [2][]byte{[]byte("testDumpk1"), []byte("testDumpv1")}
	ch <- [2][]byte{[]byte("testDumpk2"), []byte("testDumpv2")}
	close(ch)
	wa.Wait()
	if val, ex := c.Get([]byte("testDumpk1")); !ex || bytes.Compare(val, []byte("testDumpv1")) != 0 {
		t.Errorf("wrong value")
	}
	if val, ex := c.Get([]byte("testDumpk2")); !ex || bytes.Compare(val, []byte("testDumpv2")) != 0 {
		t.Errorf("wrong value")
	}
}
示例#4
0
文件: god_cli.go 项目: rhino1998/god
func subPrev(conn *client.Conn, args []string) {
	if key, value, existed := conn.SubPrev([]byte(args[1]), []byte(args[2])); existed {
		fmt.Printf("%v => %v\n", string(key), decode(value))
	}
}
示例#5
0
文件: god_cli.go 项目: rhino1998/god
func describeAll(conn *client.Conn, args []string) {
	for _, description := range conn.DescribeAllNodes() {
		fmt.Println(description.Describe())
	}
}
示例#6
0
文件: god_cli.go 项目: rhino1998/god
func del(conn *client.Conn, args []string) {
	conn.Del([]byte(args[1]))
}
示例#7
0
文件: god_cli.go 项目: rhino1998/god
func configure(conn *client.Conn, args []string) {
	conn.AddConfiguration(args[1], args[2])
}
示例#8
0
文件: god_cli.go 项目: rhino1998/god
func put(conn *client.Conn, args []string) {
	conn.Put([]byte(args[1]), encode(args[2]))
}
示例#9
0
文件: god_cli.go 项目: rhino1998/god
func subClear(conn *client.Conn, args []string) {
	conn.SubClear([]byte(args[1]))
}
示例#10
0
文件: god_cli.go 项目: rhino1998/god
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))
	}
}
示例#11
0
文件: god_cli.go 项目: rhino1998/god
func size(conn *client.Conn, args []string) {
	fmt.Println(conn.Size())
}
示例#12
0
文件: god_cli.go 项目: rhino1998/god
func subConfigure(conn *client.Conn, args []string) {
	conn.SubAddConfiguration([]byte(args[1]), args[2], args[3])
}
示例#13
0
文件: god_cli.go 项目: rhino1998/god
func indexOf(conn *client.Conn, args []string) {
	if index, existed := conn.IndexOf([]byte(args[1]), []byte(args[2])); existed {
		fmt.Println(index)
	}
}
示例#14
0
文件: god_cli.go 项目: rhino1998/god
func reverseSliceLen(conn *client.Conn, args []string) {
	for _, item := range conn.ReverseSliceLen([]byte(args[1]), []byte(args[2]), true, *(mustAtoi(args[3]))) {
		fmt.Printf("%v => %v\n", string(item.Key), decode(item.Value))
	}
}
示例#15
0
文件: god_cli.go 项目: rhino1998/god
func slice(conn *client.Conn, args []string) {
	for i, item := range conn.Slice([]byte(args[1]), []byte(args[2]), []byte(args[3]), true, false) {
		fmt.Printf("%v: %v => %v\n", i, string(item.Key), decode(item.Value))
	}
}
示例#16
0
文件: god_cli.go 项目: rhino1998/god
func sliceIndex(conn *client.Conn, args []string) {
	for _, item := range conn.SliceIndex([]byte(args[1]), mustAtoi(args[2]), mustAtoi(args[3])) {
		fmt.Printf("%v: %v => %v\n", item.Index, string(item.Key), decode(item.Value))
	}
}
示例#17
0
文件: god_cli.go 项目: rhino1998/god
func describeAllTrees(conn *client.Conn, args []string) {
	fmt.Print(conn.DescribeAllTrees())
}
示例#18
0
文件: god_cli.go 项目: rhino1998/god
func dump(conn *client.Conn, args []string) {
	dump, wait := conn.Dump()
	linedump(dump, wait)
}
示例#19
0
文件: god_cli.go 项目: rhino1998/god
func show(conn *client.Conn) {
	fmt.Println(conn.Describe())
}
示例#20
0
文件: god_cli.go 项目: rhino1998/god
func subSize(conn *client.Conn, args []string) {
	fmt.Println(conn.SubSize([]byte(args[1])))
}
示例#21
0
文件: god_cli.go 项目: rhino1998/god
func clear(conn *client.Conn, args []string) {
	conn.Clear()
}
示例#22
0
文件: god_cli.go 项目: rhino1998/god
func count(conn *client.Conn, args []string) {
	fmt.Println(conn.Count([]byte(args[1]), []byte(args[2]), []byte(args[3]), true, false))
}
示例#23
0
文件: god_cli.go 项目: rhino1998/god
func subDump(conn *client.Conn, args []string) {
	dump, wait := conn.SubDump([]byte(args[1]))
	linedump(dump, wait)
}
示例#24
0
文件: god_cli.go 项目: rhino1998/god
func nextIndex(conn *client.Conn, args []string) {
	if key, value, index, existed := conn.NextIndex([]byte(args[1]), *(mustAtoi(args[2]))); existed {
		fmt.Printf("%v: %v => %v\n", index, string(key), decode(value))
	}
}
示例#25
0
文件: god_cli.go 项目: rhino1998/god
func subPut(conn *client.Conn, args []string) {
	conn.SubPut([]byte(args[1]), []byte(args[2]), encode(args[3]))
}
示例#26
0
文件: god_cli.go 项目: rhino1998/god
func next(conn *client.Conn, args []string) {
	if key, value, existed := conn.Next([]byte(args[1])); existed {
		fmt.Printf("%v => %v\n", string(key), decode(value))
	}
}
示例#27
0
文件: god_cli.go 项目: rhino1998/god
func subDel(conn *client.Conn, args []string) {
	conn.SubDel([]byte(args[1]), []byte(args[2]))
}
示例#28
0
文件: god_cli.go 项目: rhino1998/god
func mirrorLast(conn *client.Conn, args []string) {
	if key, value, existed := conn.MirrorLast([]byte(args[1])); existed {
		fmt.Println(decode(key), "=>", string(value))
	}
}
示例#29
0
文件: god_cli.go 项目: rhino1998/god
func last(conn *client.Conn, args []string) {
	if key, value, existed := conn.Last([]byte(args[1])); existed {
		fmt.Println(string(key), "=>", decode(value))
	}
}
示例#30
0
文件: god_cli.go 项目: rhino1998/god
func subConfiguration(conn *client.Conn, args []string) {
	fmt.Println(conn.SubConfiguration([]byte(args[1])))
}