Class: Aerospike::CDT::Context
- Inherits:
-
Object
- Object
- Aerospike::CDT::Context
- Defined in:
- lib/aerospike/cdt/context.rb
Overview
Nested CDT context. Identifies the location of nested list/map to apply the operation. for the current level. An array of CTX identifies location of the list/map on multiple levels on nesting.
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#value ⇒ Object
Returns the value of attribute value.
Class Method Summary collapse
-
.list_index(index) ⇒ Object
Lookup list by index offset.
-
.list_index_create(index, order, pad) ⇒ Object
Create list with given type at index offset, given an order and pad.
-
.list_rank(rank) ⇒ Object
Lookup list by rank.
-
.list_value(key) ⇒ Object
Lookup list by value.
-
.map_index(index) ⇒ Object
Lookup map by index offset.
-
.map_key(key) ⇒ Object
Lookup map by key.
-
.map_key_create(key, order) ⇒ Object
Create map with given type at map key.
-
.map_rank(rank) ⇒ Object
Lookup map by rank.
-
.map_value(key) ⇒ Object
Lookup map by value.
Instance Method Summary collapse
-
#initialize(id, value) ⇒ Context
constructor
A new instance of Context.
Constructor Details
#initialize(id, value) ⇒ Context
Returns a new instance of Context.
32 33 34 35 |
# File 'lib/aerospike/cdt/context.rb', line 32 def initialize(id, value) @id = id @value = value end |
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
30 31 32 |
# File 'lib/aerospike/cdt/context.rb', line 30 def id @id end |
#value ⇒ Object
Returns the value of attribute value.
30 31 32 |
# File 'lib/aerospike/cdt/context.rb', line 30 def value @value end |
Class Method Details
.list_index(index) ⇒ Object
Lookup list by index offset. 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. Examples: 0: First item. 4: Fifth item. -1: Last item. -3: Third to last item.
52 53 54 |
# File 'lib/aerospike/cdt/context.rb', line 52 def self.list_index(index) Context.new(0x10, index) end |
.list_index_create(index, order, pad) ⇒ Object
Create list with given type at index offset, given an order and pad.
39 40 41 |
# File 'lib/aerospike/cdt/context.rb', line 39 def self.list_index_create(index, order, pad) Context.new(0x10 | ListOrder.flag(order, pad), index) end |
.list_rank(rank) ⇒ Object
Lookup list by rank. 0 = smallest value N = Nth smallest value -1 = largest value
61 62 63 |
# File 'lib/aerospike/cdt/context.rb', line 61 def self.list_rank(rank) Context.new(0x11, rank) end |
.list_value(key) ⇒ Object
Lookup list by value.
67 68 69 |
# File 'lib/aerospike/cdt/context.rb', line 67 def self.list_value(key) Context.new(0x13, key) end |
.map_index(index) ⇒ Object
Lookup map by index offset. 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. Examples: 0: First item. 4: Fifth item. -1: Last item. -3: Third to last item.
80 81 82 |
# File 'lib/aerospike/cdt/context.rb', line 80 def self.map_index(index) Context.new(0x20, index) end |
.map_key(key) ⇒ Object
Lookup map by key.
95 96 97 |
# File 'lib/aerospike/cdt/context.rb', line 95 def self.map_key(key) Context.new(0x22, key) end |
.map_key_create(key, order) ⇒ Object
Create map with given type at map key.
101 102 103 |
# File 'lib/aerospike/cdt/context.rb', line 101 def self.map_key_create(key, order) Context.new(0x22 | order[:flag], key) end |