doulu2591
2017-09-27 06:55 阅读 79
已采纳

如何使用golang在Aerospike中添加列表?

In aerospike, the https://godoc.org/github.com/aerospike/aerospike-client-go#ListAppendOp operation can be used along with client.Operate method to append to a list. Is there a way to Prepend to the list ?

The http://www.aerospike.com/docs/guide/cdt-list.html#development-guidelines-and-tips does mention that insertions can happen at either end of the list. But could not find the right API to do the same. Any help ?

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

1条回答 默认 最新

  • 已采纳
    douchixu3686 douchixu3686 2017-09-27 07:38

    Not familiar with Go client but just looking at the API, would specifying the index as 0 prepend it?

    func ListInsertOp
    func ListInsertOp(binName string, index int, values ...interface{}) *Operation
    ListInsertOp creates a list insert operation. Server inserts value to specified index of list bin. Server returns list size on bin name. It will panic is no values have been passed.
    
    点赞 评论 复制链接分享

相关推荐