Class: CassandraDB::Statements::Update

Inherits:
Base
  • Object
show all
Defined in:
lib/cassandra_db/statements.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#options, #to_s

Constructor Details

#initialize(table:, attributes:, conditions:) ⇒ Update

Returns a new instance of Update.



79
80
81
82
83
# File 'lib/cassandra_db/statements.rb', line 79

def initialize(table:, attributes:, conditions:)
  @table = table
  @attributes = attributes
  @conditions = conditions
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



77
78
79
# File 'lib/cassandra_db/statements.rb', line 77

def attributes
  @attributes
end

#conditionsObject (readonly)

Returns the value of attribute conditions.



77
78
79
# File 'lib/cassandra_db/statements.rb', line 77

def conditions
  @conditions
end

#tableObject (readonly)

Returns the value of attribute table.



77
78
79
# File 'lib/cassandra_db/statements.rb', line 77

def table
  @table
end

Instance Method Details

#argumentsObject



89
90
91
# File 'lib/cassandra_db/statements.rb', line 89

def arguments
  @arguments ||= attributes.merge(conditions_agruments)
end

#cqlObject



85
86
87
# File 'lib/cassandra_db/statements.rb', line 85

def cql
  @cql ||= "UPDATE #{table} SET #{filed_mappings} #{where_cql}"
end