Class: OrientDB::AR::Query
- Inherits:
-
Object
- Object
- OrientDB::AR::Query
- Defined in:
- lib/orientdb-ar/sql/query.rb
Instance Attribute Summary collapse
-
#model ⇒ Object
Returns the value of attribute model.
-
#query ⇒ Object
Returns the value of attribute query.
Class Method Summary collapse
Instance Method Summary collapse
- #all ⇒ Object
- #delete ⇒ Object
- #first ⇒ Object
- #first_result ⇒ Object
-
#initialize(model, query = OrientDB::SQL::Query.new) ⇒ Query
constructor
A new instance of Query.
- #inspect ⇒ Object (also: #to_s)
- #results ⇒ Object
- #update(*args) ⇒ Object
Constructor Details
Instance Attribute Details
#model ⇒ Object
Returns the value of attribute model.
3 4 5 |
# File 'lib/orientdb-ar/sql/query.rb', line 3 def model @model end |
#query ⇒ Object
Returns the value of attribute query.
3 4 5 |
# File 'lib/orientdb-ar/sql/query.rb', line 3 def query @query end |
Class Method Details
Instance Method Details
#all ⇒ Object
23 24 25 |
# File 'lib/orientdb-ar/sql/query.rb', line 23 def all model.connection.all(query).map { |doc| doc.to_orientdb_ar } end |
#delete ⇒ Object
43 44 45 |
# File 'lib/orientdb-ar/sql/query.rb', line 43 def delete OrientDB::AR::Delete.from_query(self).run end |
#first ⇒ Object
27 28 29 |
# File 'lib/orientdb-ar/sql/query.rb', line 27 def first model.connection.first(query).to_orientdb_ar end |
#first_result ⇒ Object
35 36 37 |
# File 'lib/orientdb-ar/sql/query.rb', line 35 def first_result model.connection.first(query) end |
#inspect ⇒ Object Also known as: to_s
47 48 49 |
# File 'lib/orientdb-ar/sql/query.rb', line 47 def inspect %{#<OrientDB::AR::Query:#{model.name} query="#{query.to_s}">} end |
#results ⇒ Object
31 32 33 |
# File 'lib/orientdb-ar/sql/query.rb', line 31 def results model.connection.all(query).map end |
#update(*args) ⇒ Object
39 40 41 |
# File 'lib/orientdb-ar/sql/query.rb', line 39 def update(*args) OrientDB::AR::Update.from_query(self, *args).run end |