Module: Cassie::Statements::Statement::Selection::ClassMethods
- Defined in:
- lib/cassie/statements/statement/selection.rb
Instance Method Summary collapse
-
#count(selector = '*') ⇒ Object
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. -
#select(column, opts = {}) ⇒ String
DSL to add a column to be ruturned for each row in the query results.
-
#select_from(table) {|_self| ... } ⇒ void
DSL to set the statement type and table for selection.
-
#selectors ⇒ Array<String>
The enumeration of selectors for use in the statement.
-
#ttl(selector) ⇒ Object
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. -
#write_time(selector) ⇒ Object
(also: #writetime)
DSL to wrap a selector in the
WRITETIME
CQL, used to select the time the field was written instead of the value itself.
Instance Method Details
#count(selector = '*') ⇒ Object
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
86 87 88 |
# File 'lib/cassie/statements/statement/selection.rb', line 86 def count(selector='*') "COUNT(#{selector})" end |
#select(column, opts = {}) ⇒ String
DSL to add a column to be ruturned for each row in the query results
56 57 58 59 60 |
# 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| ... } ⇒ void
This method returns an undefined value.
DSL to set the statement type and table for selection
44 45 46 47 48 49 |
# 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 ⇒ Array<String>
The enumeration of selectors for use in the statement
64 65 66 |
# File 'lib/cassie/statements/statement/selection.rb', line 64 def selectors @selectors ||= [] end |
#ttl(selector) ⇒ Object
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
79 80 81 |
# File 'lib/cassie/statements/statement/selection.rb', line 79 def ttl(selector) "TTL(#{selector})" end |
#write_time(selector) ⇒ Object Also known as: writetime
DSL to wrap a selector in the WRITETIME
CQL, used to select the time the field was written instead of the value itself
71 72 73 |
# File 'lib/cassie/statements/statement/selection.rb', line 71 def write_time(selector) "WRITETIME(#{selector})" end |