ListOp
in package
List operations support negative indexing. If the index is negative, the resolved index starts backwards from end of list. If an index is out of bounds, a parameter error will be returned. If a range is partially out of bounds, the valid part of the range will be returned. Index/Range examples:
Index/Range examples:
Index 0: First item in list. Index 4: Fifth item in list. Index -1: Last item in list. Index -3: Third to last item in list. Index 1 Count 2: Second and third items in list. Index -3 Count 3: Last three items in list. Index -5 Count 4: Range between fifth to last item to second to last item inclusive.
Table of Contents
Methods
- append() : Operation
- ListAppendOp creates a list append operation.
- clear() : Operation
- ListClearOp creates a list clear operation.
- create() : Operation
- ListCreateOp creates list create operation.
- getByIndex() : Operation
- ListGetByIndexOp creates list get by index operation.
- getByIndexRange() : Operation
- ListGetByIndexRangeOp creates list get by index range operation.
- getByIndexRangeCount() : Operation
- ListGetByIndexRangeCountOp creates list get by index range operation.
- getByRank() : Operation
- ListGetByRankOp creates a list get by rank operation.
- getByRankRange() : Operation
- ListGetByRankRangeOp creates a list get by rank range operation.
- getByRankRangeCount() : Operation
- ListGetByRankRangeCountOp creates a list get by rank range operation.
- getByValueRange() : Operation
- ListGetByValueRangeOp creates a list get by value range operation.
- getByValueRelativeRankRange() : Operation
- ListGetByValueRelativeRankRangeOp creates a list get by value relative to rank range operation.
- getByValueRelativeRankRangeCount() : Operation
- ListGetByValueRelativeRankRangeCountOp creates a list get by value relative to rank range operation.
- getByValues() : Operation
- ListGetByValueOp creates a list get by value operation.
- increment() : Operation
- ListIncrementOp creates a list increment operation.
- insert() : Operation
- ListInsertOp creates a list insert operation.
- pop() : Operation
- ListPopOp creates list pop operation.
- popRange() : Operation
- ListPopRangeOp creates a list pop range operation.
- popRangeFrom() : Operation
- ListPopRangeFromOp creates a list pop range operation.
- removeByIndex() : Operation
- ListRemoveByIndexOp creates a list remove operation.
- removeByIndexRange() : Operation
- ListRemoveByIndexRangeOp creates a list remove operation.
- removeByIndexRangeCount() : Operation
- ListRemoveByIndexRangeCountOp creates a list remove operation.
- removeByRank() : Operation
- ListRemoveByRankOp creates a list remove operation.
- removeByRankRange() : Operation
- ListRemoveByRankRangeOp creates a list remove operation.
- removeByRankRangeCount() : Operation
- ListRemoveByRankRangeCountOp creates a list remove operation.
- removeByValueRange() : Operation
- ListRemoveByValueRangeOp creates a list remove operation.
- removeByValueRelativeRankRange() : Operation
- ListRemoveByValueRelativeRankRangeOp creates a list remove by value relative to rank range operation.
- removeByValueRelativeRankRangeCount() : Operation
- ListRemoveByValueRelativeRankRangeCountOp creates a list remove by value relative to rank range operation.
- removeRange() : Operation
- ListRemoveRangeOp creates a list remove range operation.
- removeRangeFrom() : Operation
- ListRemoveRangeFromOp creates a list remove range operation.
- removeValues() : Operation
- ListRemoveByValueOp creates list remove by value operation.
- set() : Operation
- ListSetOp creates a list set operation.
- setOrder() : Operation
- ListSetOrderOp creates a set list order operation.
- size() : Operation
- ListSizeOp creates a list size operation.
- sort() : Operation
- ListSortOp creates list sort operation.
- trim() : Operation
- ListTrimOp creates a list trim operation.
Methods
append()
ListAppendOp creates a list append operation.
public
static append(ListPolicy $policy, string $bin_name, array<string|int, mixed> $values, array<string|int, mixed>|null $ctx) : Operation
Server appends values to end of list bin. Server returns list size on bin name. It will panic is no values have been passed.
Parameters
- $policy : ListPolicy
- $bin_name : string
- $values : array<string|int, mixed>
- $ctx : array<string|int, mixed>|null
Return values
Operationclear()
ListClearOp creates a list clear operation.
public
static clear(string $bin_name, array<string|int, mixed>|null $ctx) : Operation
Server removes all items in list bin. Server does not return a result by default.
Parameters
- $bin_name : string
- $ctx : array<string|int, mixed>|null
Return values
Operationcreate()
ListCreateOp creates list create operation.
public
static create(string $bin_name, mixed $order, bool $pad, array<string|int, mixed>|null $ctx) : Operation
Server creates list at given context level. The context is allowed to be beyond list boundaries only if pad is set to true. In that case, nil list entries will be inserted to satisfy the context position.
Parameters
- $bin_name : string
- $order : mixed
- $pad : bool
- $ctx : array<string|int, mixed>|null
Return values
OperationgetByIndex()
ListGetByIndexOp creates list get by index operation.
public
static getByIndex(string $bin_name, int $index, mixed $return_type, array<string|int, mixed>|null $ctx) : Operation
Server selects list item identified by index and returns selected data specified by returnType
Parameters
- $bin_name : string
- $index : int
- $return_type : mixed
- $ctx : array<string|int, mixed>|null
Return values
OperationgetByIndexRange()
ListGetByIndexRangeOp creates list get by index range operation.
public
static getByIndexRange(string $bin_name, int $index, mixed $return_type, array<string|int, mixed>|null $ctx) : Operation
Server selects list items starting at specified index to the end of list and returns selected data specified by returnType.
Parameters
- $bin_name : string
- $index : int
- $return_type : mixed
- $ctx : array<string|int, mixed>|null
Return values
OperationgetByIndexRangeCount()
ListGetByIndexRangeCountOp creates list get by index range operation.
public
static getByIndexRangeCount(string $bin_name, int $index, int $count, mixed $return_type, array<string|int, mixed>|null $ctx) : Operation
Server selects "count" list items starting at specified index and returns selected data specified by returnType.
Parameters
- $bin_name : string
- $index : int
- $count : int
- $return_type : mixed
- $ctx : array<string|int, mixed>|null
Return values
OperationgetByRank()
ListGetByRankOp creates a list get by rank operation.
public
static getByRank(string $bin_name, int $rank, mixed $return_type, array<string|int, mixed>|null $ctx) : Operation
Server selects list item identified by rank and returns selected data specified by returnType.
Parameters
- $bin_name : string
- $rank : int
- $return_type : mixed
- $ctx : array<string|int, mixed>|null
Return values
OperationgetByRankRange()
ListGetByRankRangeOp creates a list get by rank range operation.
public
static getByRankRange(string $bin_name, int $rank, mixed $return_type, array<string|int, mixed>|null $ctx) : Operation
Server selects list items starting at specified rank to the last ranked item and returns selected data specified by returnType
Parameters
- $bin_name : string
- $rank : int
- $return_type : mixed
- $ctx : array<string|int, mixed>|null
Return values
OperationgetByRankRangeCount()
ListGetByRankRangeCountOp creates a list get by rank range operation.
public
static getByRankRangeCount(string $bin_name, int $rank, int $count, mixed $return_type, array<string|int, mixed>|null $ctx) : Operation
Server selects "count" list items starting at specified rank and returns selected data specified by returnType.
Parameters
- $bin_name : string
- $rank : int
- $count : int
- $return_type : mixed
- $ctx : array<string|int, mixed>|null
Return values
OperationgetByValueRange()
ListGetByValueRangeOp creates a list get by value range operation.
public
static getByValueRange(string $bin_name, mixed $begin, mixed $end, mixed $return_type, array<string|int, mixed>|null $ctx) : Operation
Server selects list items identified by value range (valueBegin inclusive, valueEnd exclusive) If valueBegin is nil, the range is less than valueEnd. If valueEnd is nil, the range is greater than equal to valueBegin. Server returns selected data specified by returnType.
Parameters
- $bin_name : string
- $begin : mixed
- $end : mixed
- $return_type : mixed
- $ctx : array<string|int, mixed>|null
Return values
OperationgetByValueRelativeRankRange()
ListGetByValueRelativeRankRangeOp creates a list get by value relative to rank range operation.
public
static getByValueRelativeRankRange(string $bin_name, mixed $value, int $rank, mixed $return_type, array<string|int, mixed>|null $ctx) : Operation
Server selects list items nearest to value and greater by relative rank. Server returns selected data specified by returnType.
Examples for ordered list [0,4,5,9,11,15]:
(value,rank) = [selected items] (5,0) = [5,9,11,15] (5,1) = [9,11,15] (5,-1) = [4,5,9,11,15] (3,0) = [4,5,9,11,15] (3,3) = [11,15] (3,-3) = [0,4,5,9,11,15]
Parameters
- $bin_name : string
- $value : mixed
- $rank : int
- $return_type : mixed
- $ctx : array<string|int, mixed>|null
Return values
OperationgetByValueRelativeRankRangeCount()
ListGetByValueRelativeRankRangeCountOp creates a list get by value relative to rank range operation.
public
static getByValueRelativeRankRangeCount(string $bin_name, mixed $value, int $rank, int $count, mixed $return_type, array<string|int, mixed>|null $ctx) : Operation
Server selects list items nearest to value and greater by relative rank with a count limit. Server returns selected data specified by returnType.
Examples for ordered list [0,4,5,9,11,15]:
(value,rank,count) = [selected items] (5,0,2) = [5,9] (5,1,1) = [9] (5,-1,2) = [4,5] (3,0,1) = [4] (3,3,7) = [11,15] (3,-3,2) = []
Parameters
- $bin_name : string
- $value : mixed
- $rank : int
- $count : int
- $return_type : mixed
- $ctx : array<string|int, mixed>|null
Return values
OperationgetByValues()
ListGetByValueOp creates a list get by value operation.
public
static getByValues(string $bin_name, array<string|int, mixed> $values, mixed $return_type, array<string|int, mixed>|null $ctx) : Operation
Server selects list items identified by value and returns selected data specified by returnType.
Parameters
- $bin_name : string
- $values : array<string|int, mixed>
- $return_type : mixed
- $ctx : array<string|int, mixed>|null
Return values
Operationincrement()
ListIncrementOp creates a list increment operation.
public
static increment(string $bin_name, int $index, mixed $value, array<string|int, mixed>|null $ctx) : Operation
Server increments list[index] by value. Value should be integer(IntegerValue, LongValue) or float(FloatValue). Server returns list[index] after incrementing.
Parameters
- $bin_name : string
- $index : int
- $value : mixed
- $ctx : array<string|int, mixed>|null
Return values
Operationinsert()
ListInsertOp creates a list insert operation.
public
static insert(ListPolicy $policy, string $bin_name, int $index, array<string|int, mixed> $values, array<string|int, mixed>|null $ctx) : 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.
Parameters
- $policy : ListPolicy
- $bin_name : string
- $index : int
- $values : array<string|int, mixed>
- $ctx : array<string|int, mixed>|null
Return values
Operationpop()
ListPopOp creates list pop operation.
public
static pop(string $bin_name, int $index, array<string|int, mixed>|null $ctx) : Operation
Server returns item at specified index and removes item from list bin.
Parameters
- $bin_name : string
- $index : int
- $ctx : array<string|int, mixed>|null
Return values
OperationpopRange()
ListPopRangeOp creates a list pop range operation.
public
static popRange(string $bin_name, int $index, int $count, array<string|int, mixed>|null $ctx) : Operation
Server returns items starting at specified index and removes items from list bin.
Parameters
- $bin_name : string
- $index : int
- $count : int
- $ctx : array<string|int, mixed>|null
Return values
OperationpopRangeFrom()
ListPopRangeFromOp creates a list pop range operation.
public
static popRangeFrom(string $bin_name, int $index, array<string|int, mixed>|null $ctx) : Operation
Server returns items starting at specified index to the end of list and removes items from list bin.
Parameters
- $bin_name : string
- $index : int
- $ctx : array<string|int, mixed>|null
Return values
OperationremoveByIndex()
ListRemoveByIndexOp creates a list remove operation.
public
static removeByIndex(string $bin_name, int $index, mixed $return_type, array<string|int, mixed>|null $ctx) : Operation
Server removes list item identified by index and returns removed data specified by returnType.
Parameters
- $bin_name : string
- $index : int
- $return_type : mixed
- $ctx : array<string|int, mixed>|null
Return values
OperationremoveByIndexRange()
ListRemoveByIndexRangeOp creates a list remove operation.
public
static removeByIndexRange(string $bin_name, int $index, mixed $return_type, array<string|int, mixed>|null $ctx) : Operation
Server removes list items starting at specified index to the end of list and returns removed data specified by returnType.
Parameters
- $bin_name : string
- $index : int
- $return_type : mixed
- $ctx : array<string|int, mixed>|null
Return values
OperationremoveByIndexRangeCount()
ListRemoveByIndexRangeCountOp creates a list remove operation.
public
static removeByIndexRangeCount(string $bin_name, int $index, int $count, mixed $return_type, array<string|int, mixed>|null $ctx) : Operation
Server removes "count" list items starting at specified index and returns removed data specified by returnType.
Parameters
- $bin_name : string
- $index : int
- $count : int
- $return_type : mixed
- $ctx : array<string|int, mixed>|null
Return values
OperationremoveByRank()
ListRemoveByRankOp creates a list remove operation.
public
static removeByRank(string $bin_name, int $rank, mixed $return_type, array<string|int, mixed>|null $ctx) : Operation
Server removes list item identified by rank and returns removed data specified by returnType.
Parameters
- $bin_name : string
- $rank : int
- $return_type : mixed
- $ctx : array<string|int, mixed>|null
Return values
OperationremoveByRankRange()
ListRemoveByRankRangeOp creates a list remove operation.
public
static removeByRankRange(string $bin_name, int $rank, mixed $return_type, array<string|int, mixed>|null $ctx) : Operation
Server removes list items starting at specified rank to the last ranked item and returns removed data specified by returnType.
Parameters
- $bin_name : string
- $rank : int
- $return_type : mixed
- $ctx : array<string|int, mixed>|null
Return values
OperationremoveByRankRangeCount()
ListRemoveByRankRangeCountOp creates a list remove operation.
public
static removeByRankRangeCount(string $bin_name, int $rank, int $count, mixed $return_type, array<string|int, mixed>|null $ctx) : Operation
Server removes "count" list items starting at specified rank and returns removed data specified by returnType.
Parameters
- $bin_name : string
- $rank : int
- $count : int
- $return_type : mixed
- $ctx : array<string|int, mixed>|null
Return values
OperationremoveByValueRange()
ListRemoveByValueRangeOp creates a list remove operation.
public
static removeByValueRange(string $bin_name, mixed $begin, mixed $end, mixed $return_type, array<string|int, mixed>|null $ctx) : Operation
Server removes list items identified by value range (valueBegin inclusive, valueEnd exclusive). If valueBegin is nil, the range is less than valueEnd. If valueEnd is nil, the range is greater than equal to valueBegin. Server returns removed data specified by returnType
Parameters
- $bin_name : string
- $begin : mixed
- $end : mixed
- $return_type : mixed
- $ctx : array<string|int, mixed>|null
Return values
OperationremoveByValueRelativeRankRange()
ListRemoveByValueRelativeRankRangeOp creates a list remove by value relative to rank range operation.
public
static removeByValueRelativeRankRange(string $bin_name, mixed $value, int $rank, mixed $return_type, array<string|int, mixed>|null $ctx) : Operation
Server removes list items nearest to value and greater by relative rank. Server returns removed data specified by returnType.
Examples for ordered list [0,4,5,9,11,15]:
(value,rank) = [removed items] (5,0) = [5,9,11,15] (5,1) = [9,11,15] (5,-1) = [4,5,9,11,15] (3,0) = [4,5,9,11,15] (3,3) = [11,15] (3,-3) = [0,4,5,9,11,15]
Parameters
- $bin_name : string
- $value : mixed
- $rank : int
- $return_type : mixed
- $ctx : array<string|int, mixed>|null
Return values
OperationremoveByValueRelativeRankRangeCount()
ListRemoveByValueRelativeRankRangeCountOp creates a list remove by value relative to rank range operation.
public
static removeByValueRelativeRankRangeCount(string $bin_name, mixed $value, int $rank, int $count, mixed $return_type, array<string|int, mixed>|null $ctx) : Operation
Server removes list items nearest to value and greater by relative rank with a count limit. Server returns removed data specified by returnType. Examples for ordered list [0,4,5,9,11,15]:
(value,rank,count) = [removed items] (5,0,2) = [5,9] (5,1,1) = [9] (5,-1,2) = [4,5] (3,0,1) = [4] (3,3,7) = [11,15] (3,-3,2) = []
Parameters
- $bin_name : string
- $value : mixed
- $rank : int
- $count : int
- $return_type : mixed
- $ctx : array<string|int, mixed>|null
Return values
OperationremoveRange()
ListRemoveRangeOp creates a list remove range operation.
public
static removeRange(string $bin_name, int $index, int $count, array<string|int, mixed>|null $ctx) : Operation
Server removes "count" items starting at specified index from list bin. Server returns number of items removed.
Parameters
- $bin_name : string
- $index : int
- $count : int
- $ctx : array<string|int, mixed>|null
Return values
OperationremoveRangeFrom()
ListRemoveRangeFromOp creates a list remove range operation.
public
static removeRangeFrom(string $bin_name, int $index, array<string|int, mixed>|null $ctx) : Operation
Server removes all items starting at specified index to the end of list. Server returns number of items removed.
Parameters
- $bin_name : string
- $index : int
- $ctx : array<string|int, mixed>|null
Return values
OperationremoveValues()
ListRemoveByValueOp creates list remove by value operation.
public
static removeValues(string $bin_name, array<string|int, mixed> $values, mixed $return_type, array<string|int, mixed>|null $ctx) : Operation
Server removes the item identified by value and returns removed data specified by returnType.
Parameters
- $bin_name : string
- $values : array<string|int, mixed>
- $return_type : mixed
- $ctx : array<string|int, mixed>|null
Return values
Operationset()
ListSetOp creates a list set operation.
public
static set(string $bin_name, int $index, mixed $value, array<string|int, mixed>|null $ctx) : Operation
Server sets item value at specified index in list bin. Server does not return a result by default.
Parameters
- $bin_name : string
- $index : int
- $value : mixed
- $ctx : array<string|int, mixed>|null
Return values
OperationsetOrder()
ListSetOrderOp creates a set list order operation.
public
static setOrder(string $bin_name, mixed $order, array<string|int, mixed>|null $ctx) : Operation
Server sets list order. Server returns nil.
Parameters
- $bin_name : string
- $order : mixed
- $ctx : array<string|int, mixed>|null
Return values
Operationsize()
ListSizeOp creates a list size operation.
public
static size(string $bin_name, array<string|int, mixed>|null $ctx) : Operation
Server returns size of list on bin name.
Parameters
- $bin_name : string
- $ctx : array<string|int, mixed>|null
Return values
Operationsort()
ListSortOp creates list sort operation.
public
static sort(string $bin_name, ListSortFlags $sort_flags, array<string|int, mixed>|null $ctx) : Operation
Server sorts list according to sortFlags. Server does not return a result by default.
Parameters
- $bin_name : string
- $sort_flags : ListSortFlags
- $ctx : array<string|int, mixed>|null
Return values
Operationtrim()
ListTrimOp creates a list trim operation.
public
static trim(string $bin_name, int $index, int $count, array<string|int, mixed>|null $ctx) : Operation
Server removes items in list bin that do not fall into range specified by index and count range. If the range is out of bounds, then all items will be removed. Server returns number of elements that were removed.
Parameters
- $bin_name : string
- $index : int
- $count : int
- $ctx : array<string|int, mixed>|null