doulu2591 2017-09-27 06:55
浏览 99
已采纳

如何使用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 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.
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?