Crusaderpyro
Crusaderpyro

Reputation: 2242

How to Prepend to a list in aerospike using golang?

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 ?

Upvotes: 2

Views: 245

Answers (1)

pgupta
pgupta

Reputation: 5415

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.

Upvotes: 4

Related Questions