Skip to content

Range operations

For the complete documentation index see: llms.txt

All documentation pages available in markdown.

Use the Aerospike Go client to read a range of items from a list bin on the server, selected by index range, by rank range, or by value range. Each operation runs through Operate() and lets you choose what the server returns, such as the values or the indexes, so you don’t fetch the whole list.

ListGetByIndexRangeOp: get by index range

Retrieves items within an index range.

// Get items from index 5 to 15
record, err := client.Operate(nil, key,
as.ListGetByIndexRangeOp("items", 5, as.ListReturnTypeValue),
)

ListGetByRankRangeOp: get by rank range

Retrieves items within a rank range (sorted by value).

// Get top 5 items (ranks 0-4)
record, err := client.Operate(nil, key,
as.ListGetByRankRangeOp("scores", 0, as.ListReturnTypeValue),
)

ListGetByValueRangeOp: get by value range

Retrieves items with values within a specified range.

// Get items with values between 10 and 50
record, err := client.Operate(nil, key,
as.ListGetByValueRangeOp("prices", 10.0, 50.0, as.ListReturnTypeValue),
)

Next steps