Module: CassandraObject::Scope::QueryMethods
- Included in:
- CassandraObject::Scope
- Defined in:
- lib/cassandra_object/scope/query_methods.rb
Instance Method Summary collapse
- #columns ⇒ Object
- #cql_response ⇒ Object
- #execute ⇒ Object
- #execute_paged ⇒ Object
- #limit(value) ⇒ Object
- #limit!(value) ⇒ Object
- #select(*values, &block) ⇒ Object
- #select!(*values) ⇒ Object
- #where(*values) ⇒ Object
- #where!(*values) ⇒ Object
- #where_ids(*ids) ⇒ Object
- #where_ids!(*ids) ⇒ Object
Instance Method Details
#columns ⇒ Object
11 12 13 14 15 |
# File 'lib/cassandra_object/scope/query_methods.rb', line 11 def columns cloned = self.clone cloned.select_values = [:column1] cloned.cql_response end |
#cql_response ⇒ Object
5 6 7 8 9 |
# File 'lib/cassandra_object/scope/query_methods.rb', line 5 def cql_response cloned = self.clone cloned.raw_response = true cloned end |
#execute ⇒ Object
63 64 65 |
# File 'lib/cassandra_object/scope/query_methods.rb', line 63 def execute select_records end |
#execute_paged ⇒ Object
67 68 69 |
# File 'lib/cassandra_object/scope/query_methods.rb', line 67 def execute_paged select_records(false) end |
#limit(value) ⇒ Object
59 60 61 |
# File 'lib/cassandra_object/scope/query_methods.rb', line 59 def limit(value) clone.limit! value end |
#limit!(value) ⇒ Object
54 55 56 57 |
# File 'lib/cassandra_object/scope/query_methods.rb', line 54 def limit!(value) self.limit_value = value self end |
#select(*values, &block) ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/cassandra_object/scope/query_methods.rb', line 22 def select(*values, &block) if block_given? execute.select(&block) else clone.select!(*values) end end |
#select!(*values) ⇒ Object
17 18 19 20 |
# File 'lib/cassandra_object/scope/query_methods.rb', line 17 def select!(*values) self.select_values += values.flatten self end |
#where(*values) ⇒ Object
40 41 42 |
# File 'lib/cassandra_object/scope/query_methods.rb', line 40 def where(*values) clone.where! values end |
#where!(*values) ⇒ Object
30 31 32 33 34 35 36 37 38 |
# File 'lib/cassandra_object/scope/query_methods.rb', line 30 def where!(*values) if values.flatten.size == 1 self.where_values += values.flatten self.where_values << '' else self.where_values += values.flatten end self end |
#where_ids(*ids) ⇒ Object
50 51 52 |
# File 'lib/cassandra_object/scope/query_methods.rb', line 50 def where_ids(*ids) clone.where_ids! ids end |
#where_ids!(*ids) ⇒ Object
44 45 46 47 48 |
# File 'lib/cassandra_object/scope/query_methods.rb', line 44 def where_ids!(*ids) self.id_values += ids.flatten self.id_values.compact if self.id_values.present? self end |