class Believer::Batch

A command which issues 0 or more other commands in batch to the Cassandra server. This is achieved using the CQL BATCH command

Public Instance Methods

<<(command) click to toggle source

Adds a command @param command [Command] a command

# File lib/believer/batch.rb, line 15
def <<(command)
  add(command)
end
add(command) click to toggle source

Adds a command @param command [Command] a command

# File lib/believer/batch.rb, line 21
def add(command)
  commands << command
  self
end
commands() click to toggle source

Yields the collection of commands @return [Array<Command>] the command collection

# File lib/believer/batch.rb, line 9
def commands
  @commands ||= []
end
to_cql() click to toggle source

Yields the CQL for this command @return [String] the CQL

# File lib/believer/batch.rb, line 28
def to_cql
  cql = "BEGIN BATCH\n"
  commands.each do |c|
    cql += "  #{c.to_cql}\n"
  end
  cql += "APPLY BATCH;\n"
  cql
end