doushi7314 2017-09-26 10:45
浏览 97

Golang客户端在Aerospike中的CDT列表上执行操作

I wanted to use a list as a bin value in aerospike. So, http://www.aerospike.com/docs/guide/cdt-list.html seems like a good option. But the client examples in golang https://github.com/aerospike/aerospike-client-go/blob/master/examples/list_map.go only shows a get and a put.

key, _ := as.NewKey(*shared.Namespace, *shared.Set, "listkey1")
client.Delete(shared.WritePolicy, key)

list := []string{"string1", "string2", "string3"}

bin := as.NewBin("listbin1", list)
client.PutBins(shared.WritePolicy, key, bin)

record, err := client.Get(shared.Policy, key, bin.Name)
shared.PanicOnError(err)
receivedList := record.Bins[bin.Name].([]interface{})

validateSize(3, len(receivedList))
validate("string1", receivedList[0])
validate("string2", receivedList[1])
validate("string3", receivedList[2])

What about all other APIs mentioned ? Such as how do I append to the list or get count of objects in the list etc. ? Any reference to any documentation would be appreciated.

Thanks in advance.

  • 写回答

2条回答 默认 最新

  • dongshan4316 2017-09-26 10:56
    关注

    Don't expect examples to provide full documentation. Use the documentation for that.

    评论

报告相同问题?

悬赏问题

  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测