module Cassie::Statements::Statement::Selection::ClassMethods

Public Instance Methods

count(selector='*') click to toggle source

DSL to wrap a selector in the COUNT CQL, used to select the aggregation of the number of rows instead of the value in each row

# File lib/cassie/statements/statement/selection.rb, line 86
def count(selector='*')
  "COUNT(#{selector})"
end
select(column, opts={}) click to toggle source

DSL to add a column to be ruturned for each row in the query results @param [String, Symbol] column The column name in the CQL schmea to return @param [Hash] opts options for the selector @option opts [String] :as The identifier to use for the field when returned in the result if different than the column name @return [String] the current enumeration of selectors

# File lib/cassie/statements/statement/selection.rb, line 56
def select(column, opts={})
  column = column.to_s
  column += " AS #{opts[:as]}" if opts[:as]
  selectors << column
end
select_from(table) { |self| ... } click to toggle source

DSL to set the statement type and table for selection @param [String, Symbol] table The table to taret for the select statement @return [void]

# File lib/cassie/statements/statement/selection.rb, line 44
def select_from(table)
  self.table = table
  self.type = :select

  yield(self) if block_given?
end
selectors() click to toggle source

The enumeration of selectors for use in the statement @return [Array<String>]

# File lib/cassie/statements/statement/selection.rb, line 64
def selectors
  @selectors ||= []
end
ttl(selector) click to toggle source

DSL to wrap a selector in the TTL CQL, used to select the time until the field will be tombstoned, instead of the value itself

# File lib/cassie/statements/statement/selection.rb, line 79
def ttl(selector)
  "TTL(#{selector})"
end
write_time(selector) click to toggle source

DSL to wrap a selector in the WRITETIME CQL, used to select the time the field was written instead of the value itself

# File lib/cassie/statements/statement/selection.rb, line 71
def write_time(selector)
  "WRITETIME(#{selector})"
end
Also aliased as: writetime
writetime(selector)
Alias for: write_time