Class: Cql::Model::Query::MutationStatement
- Defined in:
- lib/cql/model/query/mutation_statement.rb
Overview
Common parent to InsertStatement and UpdateStatment provide helpers for managing common DSL settings
Direct Known Subclasses
Instance Method Summary collapse
-
#execute ⇒ true
Execute this statement on the CQL client connection INSERT statements do not return a result.
-
#initialize(klass, client = nil) ⇒ MutationStatement
constructor
Instantiate statement.
-
#timestamp(timestamp_value) ⇒ Object
DSL for setting timestamp value.
-
#ttl(ttl_value) ⇒ Object
DSL for setting TTL value.
Methods inherited from Statement
Constructor Details
#initialize(klass, client = nil) ⇒ MutationStatement
Instantiate statement
11 12 13 14 15 16 |
# File 'lib/cql/model/query/mutation_statement.rb', line 11 def initialize(klass, client=nil) super(klass, client) @values = nil @ttl = nil @timestamp = nil end |
Instance Method Details
#execute ⇒ true
Execute this statement on the CQL client connection INSERT statements do not return a result
40 41 42 43 |
# File 'lib/cql/model/query/mutation_statement.rb', line 40 def execute @client.execute(to_s) true end |
#timestamp(timestamp_value) ⇒ Object
DSL for setting timestamp value
30 31 32 33 34 |
# File 'lib/cql/model/query/mutation_statement.rb', line 30 def () raise ArgumentError, "Cannot specify timestamp twice" unless @timestamp.nil? @timestamp = self end |
#ttl(ttl_value) ⇒ Object
DSL for setting TTL value
21 22 23 24 25 |
# File 'lib/cql/model/query/mutation_statement.rb', line 21 def ttl(ttl_value) raise ArgumentError, "Cannot specify TTL twice" unless @ttl.nil? @ttl = ttl_value self end |