Class: Spinoza::Transaction::RowLocation

Inherits:
Object
  • Object
show all
Defined in:
lib/spinoza/transaction.rb

Instance Method Summary collapse

Constructor Details

#initialize(txn, table, key) ⇒ RowLocation

Returns a new instance of RowLocation.



28
29
30
# File 'lib/spinoza/transaction.rb', line 28

def initialize txn, table, key
  @txn, @table, @key = txn, table, key
end

Instance Method Details

#deleteObject



43
44
45
# File 'lib/spinoza/transaction.rb', line 43

def delete
  @txn << DeleteOperation.new(@txn, table: @table, key: @key)
end

#insert(row) ⇒ Object



32
33
34
35
36
37
# File 'lib/spinoza/transaction.rb', line 32

def insert row
  if @key and not @key.empty?
    raise ArgumentError, "Do not specify key in `at(...).insert(...)`."
  end
  @txn << InsertOperation.new(@txn, table: @table, row: row)
end

#readObject



47
48
49
# File 'lib/spinoza/transaction.rb', line 47

def read
  @txn << ReadOperation.new(@txn, table: @table, key: @key)
end

#update(row) ⇒ Object



39
40
41
# File 'lib/spinoza/transaction.rb', line 39

def update row
  @txn << UpdateOperation.new(@txn, table: @table, row: row, key: @key)
end