本文整理匯總了Golang中github.com/rhino1998/god/client.Conn類的典型用法代碼示例。如果您正苦於以下問題:Golang Conn類的具體用法?Golang Conn怎麽用?Golang Conn使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Conn類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: dumpSetOp
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: describeTree
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: testDump
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: subPrev
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: describeAll
func describeAll(conn *client.Conn, args []string) {
for _, description := range conn.DescribeAllNodes() {
fmt.Println(description.Describe())
}
}
示例6: del
func del(conn *client.Conn, args []string) {
conn.Del([]byte(args[1]))
}
示例7: configure
func configure(conn *client.Conn, args []string) {
conn.AddConfiguration(args[1], args[2])
}
示例8: put
func put(conn *client.Conn, args []string) {
conn.Put([]byte(args[1]), encode(args[2]))
}
示例9: subClear
func subClear(conn *client.Conn, args []string) {
conn.SubClear([]byte(args[1]))
}
示例10: subGet
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: size
func size(conn *client.Conn, args []string) {
fmt.Println(conn.Size())
}
示例12: subConfigure
func subConfigure(conn *client.Conn, args []string) {
conn.SubAddConfiguration([]byte(args[1]), args[2], args[3])
}
示例13: indexOf
func indexOf(conn *client.Conn, args []string) {
if index, existed := conn.IndexOf([]byte(args[1]), []byte(args[2])); existed {
fmt.Println(index)
}
}
示例14: reverseSliceLen
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: slice
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))
}
}