class Cql::Model::Query::MutationStatement

Common parent to InsertStatement and UpdateStatment provide helpers for managing common DSL settings

Public Class Methods

new(klass, client=nil) click to toggle source

Instantiate statement

@param [Class] klass @param [Cql::Client] CQL client used to execute statement

Calls superclass method
# 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

Public Instance Methods

execute() click to toggle source

Execute this statement on the CQL client connection INSERT statements do not return a result

@return [true] always returns true

# File lib/cql/model/query/mutation_statement.rb, line 40
def execute
  @client.execute(to_s)
  true
end
timestamp(timestamp_value) click to toggle source

DSL for setting timestamp value

@param [Fixnum|String] timestamp_value (number of milliseconds since epoch or ISO 8601 date time value)

# File lib/cql/model/query/mutation_statement.rb, line 30
def timestamp(timestamp_value)
  raise ArgumentError, "Cannot specify timestamp twice" unless @timestamp.nil?
  @timestamp = timestamp_value
  self
end
ttl(ttl_value) click to toggle source

DSL for setting TTL value

@param [Fixnum] ttl_value TTL value in seconds

# 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