本文整理汇总了Golang中github.com/zond/god/client.Conn类的典型用法代码示例。如果您正苦于以下问题:Golang Conn类的具体用法?Golang Conn怎么用?Golang Conn使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Conn类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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)
}
}
}
开发者ID:rrudduck,项目名称:golang-stuff,代码行数:10,代码来源:god_cli.go
示例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)
}
}
}
开发者ID:rrudduck,项目名称:golang-stuff,代码行数:11,代码来源:god_cli.go
示例3: getActives
func getActives(w http.ResponseWriter, r *http.Request, c *client.Conn) {
var result []common.Message
for _, item := range c.Slice(activeObjectsKey, nil, nil, true, true) {
result = append(result, common.Message{
Object: string(item.Key),
})
}
w.Header().Set("Content-Type", "application/json; charset=UTF-8")
if err := json.NewEncoder(w).Encode(result); err != nil {
panic(err)
}
}
开发者ID:zond,项目名称:commendable,代码行数:12,代码来源:commendable_server.go
示例4: getViews
func getViews(w http.ResponseWriter, r *http.Request, c *client.Conn) {
uid := mux.Vars(r)["user_id"]
vKey := uViewsKey(uid)
var result []common.Message
for _, item := range c.Slice(vKey, nil, nil, true, true) {
result = append(result, common.Message{
Type: common.View,
User: uid,
Object: string(item.Key),
})
}
w.Header().Set("Content-Type", "application/json; charset=UTF-8")
if err := json.NewEncoder(w).Encode(result); err != nil {
panic(err)
}
}
开发者ID:zond,项目名称:commendable,代码行数:16,代码来源:commendable_server.go
示例5: 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")
}
}
开发者ID:johnvilsack,项目名称:golang-stuff,代码行数:13,代码来源:client_test.go
示例6: describeAllTrees
func describeAllTrees(conn *client.Conn, args []string) {
fmt.Print(conn.DescribeAllTrees())
}
开发者ID:rrudduck,项目名称:golang-stuff,代码行数:3,代码来源:god_cli.go
示例7: subConfigure
func subConfigure(conn *client.Conn, args []string) {
conn.SubAddConfiguration([]byte(args[1]), args[2], args[3])
}
开发者ID:rrudduck,项目名称:golang-stuff,代码行数:3,代码来源:god_cli.go
示例8: del
func del(conn *client.Conn, args []string) {
conn.Del([]byte(args[1]))
}
开发者ID:rrudduck,项目名称:golang-stuff,代码行数:3,代码来源:god_cli.go
示例9: 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))
}
}
开发者ID:rrudduck,项目名称:golang-stuff,代码行数:5,代码来源:god_cli.go
示例10: put
func put(conn *client.Conn, args []string) {
conn.Put([]byte(args[1]), encode(args[2]))
}
开发者ID:rrudduck,项目名称:golang-stuff,代码行数:3,代码来源:god_cli.go
示例11: subClear
func subClear(conn *client.Conn, args []string) {
conn.SubClear([]byte(args[1]))
}
开发者ID:rrudduck,项目名称:golang-stuff,代码行数:3,代码来源:god_cli.go
示例12: nextIndex
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))
}
}
开发者ID:rrudduck,项目名称:golang-stuff,代码行数:5,代码来源:god_cli.go
示例13: dump
func dump(conn *client.Conn, args []string) {
dump, wait := conn.Dump()
linedump(dump, wait)
}
开发者ID:rrudduck,项目名称:golang-stuff,代码行数:4,代码来源:god_cli.go
示例14: show
func show(conn *client.Conn) {
fmt.Println(conn.Describe())
}
开发者ID:rrudduck,项目名称:golang-stuff,代码行数:3,代码来源:god_cli.go
示例15: count
func count(conn *client.Conn, args []string) {
fmt.Println(conn.Count([]byte(args[1]), []byte(args[2]), []byte(args[3]), true, false))
}
开发者ID:rrudduck,项目名称:golang-stuff,代码行数:3,代码来源:god_cli.go
示例16: indexOf
func indexOf(conn *client.Conn, args []string) {
if index, existed := conn.IndexOf([]byte(args[1]), []byte(args[2])); existed {
fmt.Println(index)
}
}
开发者ID:rrudduck,项目名称:golang-stuff,代码行数:5,代码来源:god_cli.go
示例17: size
func size(conn *client.Conn, args []string) {
fmt.Println(conn.Size())
}
开发者ID:rrudduck,项目名称:golang-stuff,代码行数:3,代码来源:god_cli.go
示例18: 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))
}
}
开发者ID:rrudduck,项目名称:golang-stuff,代码行数:5,代码来源:god_cli.go
示例19: 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))
}
}
开发者ID:rrudduck,项目名称:golang-stuff,代码行数:5,代码来源:god_cli.go
示例20: next
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))
}
}
开发者ID:rrudduck,项目名称:golang-stuff,代码行数:5,代码来源:god_cli.go
注:本文中的github.com/zond/god/client.Conn类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论