Class: Cassava::Client
- Inherits:
-
Object
- Object
- Cassava::Client
- Defined in:
- lib/cassava/client.rb
Instance Attribute Summary collapse
-
#executor ⇒ Object
readonly
Returns the value of attribute executor.
-
#session ⇒ Object
readonly
Returns the value of attribute session.
Instance Method Summary collapse
-
#delete(table, columns = nil) ⇒ StatementBuilder
A statement builder representing the partially completed statement.
-
#execute(statement, opts = {}) ⇒ Object
Pass a raw query to execute asynchronously to the underlying session object.
-
#execute_async(statement, opts = {}) ⇒ Object
Pass a raw query to execute synchronously to the underlying session object.
-
#initialize(session, opts = {}) ⇒ Client
constructor
A new instance of Client.
- #insert(table, data) ⇒ Object
- #insert_async(table, data) ⇒ Object
-
#select(table, columns = nil) ⇒ StatementBuilder
A statement builder representing the partially completed statement.
Constructor Details
#initialize(session, opts = {}) ⇒ Client
Returns a new instance of Client.
7 8 9 10 11 |
# File 'lib/cassava/client.rb', line 7 def initialize(session, opts = {}) @session = session logger = opts[:logger] || NullLogger.new @executor = Executor.new(session, logger) end |
Instance Attribute Details
#executor ⇒ Object (readonly)
Returns the value of attribute executor.
3 4 5 |
# File 'lib/cassava/client.rb', line 3 def executor @executor end |
#session ⇒ Object (readonly)
Returns the value of attribute session.
3 4 5 |
# File 'lib/cassava/client.rb', line 3 def session @session end |
Instance Method Details
#delete(table, columns = nil) ⇒ StatementBuilder
Returns A statement builder representing the partially completed statement.
35 36 37 |
# File 'lib/cassava/client.rb', line 35 def delete(table, columns = nil) StatementBuilder.new(executor).delete(table, columns) end |
#execute(statement, opts = {}) ⇒ Object
Pass a raw query to execute asynchronously to the underlying session object.
49 50 51 |
# File 'lib/cassava/client.rb', line 49 def execute(statement, opts = {}) executor.execute(statement, opts) end |
#execute_async(statement, opts = {}) ⇒ Object
Pass a raw query to execute synchronously to the underlying session object.
42 43 44 |
# File 'lib/cassava/client.rb', line 42 def execute_async(statement, opts = {}) executor.execute_async(statement, opts) end |
#insert(table, data) ⇒ Object
20 21 22 23 |
# File 'lib/cassava/client.rb', line 20 def insert(table, data) statement = insert_statement(table, data) executor.execute(statement, :arguments => data.values) end |
#insert_async(table, data) ⇒ Object
14 15 16 |
# File 'lib/cassava/client.rb', line 14 def insert_async(table, data) executor.execute_async(insert_statement(table, data), :arguments => data.values) end |
#select(table, columns = nil) ⇒ StatementBuilder
Returns A statement builder representing the partially completed statement.
28 29 30 |
# File 'lib/cassava/client.rb', line 28 def select(table, columns = nil) StatementBuilder.new(executor).select(table, columns) end |