Class: Tarantool::Crud::Space
- Inherits:
-
Object
- Object
- Tarantool::Crud::Space
- Defined in:
- tarantool-crud/lib/tarantool/crud/space.rb
Overview
Operations on one sharded space; Hash rows go to the *_object crud variants.
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #count(conditions = nil) ⇒ Object
- #delete(key) ⇒ Object
- #each(conditions = nil, batch_size: 1000, **options) ⇒ Object
- #get(key) ⇒ Object
-
#initialize(name, call) ⇒ Space
constructor
A new instance of Space.
- #insert(tuple) ⇒ Object
- #insert_many(rows) ⇒ Object
- #insert_many!(rows) ⇒ Object
- #len ⇒ Object
- #max(index = nil) ⇒ Object
- #min(index = nil) ⇒ Object
- #replace(tuple) ⇒ Object
- #replace_many(rows) ⇒ Object
- #replace_many!(rows) ⇒ Object
- #select(conditions = nil, **options) ⇒ Object
- #truncate ⇒ Object
- #update(key, operations) ⇒ Object
- #upsert(tuple, operations) ⇒ Object
- #upsert_many(pairs) ⇒ Object
- #upsert_many!(pairs) ⇒ Object
Constructor Details
#initialize(name, call) ⇒ Space
Returns a new instance of Space.
9 10 11 12 |
# File 'tarantool-crud/lib/tarantool/crud/space.rb', line 9 def initialize(name, call) @name = name.to_s @call = call end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'tarantool-crud/lib/tarantool/crud/space.rb', line 7 def name @name end |
Instance Method Details
#count(conditions = nil) ⇒ Object
40 |
# File 'tarantool-crud/lib/tarantool/crud/space.rb', line 40 def count(conditions = nil, **) = value('count', Conditions.build(conditions), **) |
#delete(key) ⇒ Object
24 |
# File 'tarantool-crud/lib/tarantool/crud/space.rb', line 24 def delete(key, **) = row('delete', key, **) |
#each(conditions = nil, batch_size: 1000, **options) ⇒ Object
36 37 38 |
# File 'tarantool-crud/lib/tarantool/crud/space.rb', line 36 def each(conditions = nil, batch_size: 1000, **, &) Scan.new(self, conditions, batch_size:, options:).each(&) end |
#get(key) ⇒ Object
20 |
# File 'tarantool-crud/lib/tarantool/crud/space.rb', line 20 def get(key, **) = row('get', key, **) |
#insert(tuple) ⇒ Object
14 |
# File 'tarantool-crud/lib/tarantool/crud/space.rb', line 14 def insert(tuple, **) = row(variant('insert', tuple), tuple, **) |
#insert_many(rows) ⇒ Object
46 |
# File 'tarantool-crud/lib/tarantool/crud/space.rb', line 46 def insert_many(rows, **) = many(many_variant('insert', rows), rows, **) |
#insert_many!(rows) ⇒ Object
52 |
# File 'tarantool-crud/lib/tarantool/crud/space.rb', line 52 def insert_many!(rows, **) = successful(insert_many(rows, **)) |
#len ⇒ Object
42 |
# File 'tarantool-crud/lib/tarantool/crud/space.rb', line 42 def len(**) = value('len', **) |
#max(index = nil) ⇒ Object
28 |
# File 'tarantool-crud/lib/tarantool/crud/space.rb', line 28 def max(index = nil, **) = row('max', index, **) |
#min(index = nil) ⇒ Object
26 |
# File 'tarantool-crud/lib/tarantool/crud/space.rb', line 26 def min(index = nil, **) = row('min', index, **) |
#replace(tuple) ⇒ Object
16 |
# File 'tarantool-crud/lib/tarantool/crud/space.rb', line 16 def replace(tuple, **) = row(variant('replace', tuple), tuple, **) |
#replace_many(rows) ⇒ Object
48 |
# File 'tarantool-crud/lib/tarantool/crud/space.rb', line 48 def replace_many(rows, **) = many(many_variant('replace', rows), rows, **) |
#replace_many!(rows) ⇒ Object
54 |
# File 'tarantool-crud/lib/tarantool/crud/space.rb', line 54 def replace_many!(rows, **) = successful(replace_many(rows, **)) |
#select(conditions = nil, **options) ⇒ Object
30 31 32 33 34 |
# File 'tarantool-crud/lib/tarantool/crud/space.rb', line 30 def select(conditions = nil, **) [:after] = [:after].values if [:after].is_a?(Hash) Result.from_crud(value('select', Conditions.build(conditions), **)) end |
#truncate ⇒ Object
44 |
# File 'tarantool-crud/lib/tarantool/crud/space.rb', line 44 def truncate(**) = value('truncate', **) |
#update(key, operations) ⇒ Object
22 |
# File 'tarantool-crud/lib/tarantool/crud/space.rb', line 22 def update(key, operations, **) = row('update', key, operations, **) |
#upsert(tuple, operations) ⇒ Object
18 |
# File 'tarantool-crud/lib/tarantool/crud/space.rb', line 18 def upsert(tuple, operations, **) = row(variant('upsert', tuple), tuple, operations, **) |
#upsert_many(pairs) ⇒ Object
50 |
# File 'tarantool-crud/lib/tarantool/crud/space.rb', line 50 def upsert_many(pairs, **) = many(many_variant('upsert', pairs.map(&:first)), pairs, **) |
#upsert_many!(pairs) ⇒ Object
56 |
# File 'tarantool-crud/lib/tarantool/crud/space.rb', line 56 def upsert_many!(pairs, **) = successful(upsert_many(pairs, **)) |