Class: Foobara::Persistence::EntityAttributesCrudDriver
- Inherits:
-
Object
- Object
- Foobara::Persistence::EntityAttributesCrudDriver
- Defined in:
- foobara-0.0.110/projects/persistence/src/entity_attributes_crud_driver.rb
Direct Known Subclasses
Defined Under Namespace
Classes: Table
Instance Attribute Summary collapse
-
#raw_connection ⇒ Object
Returns the value of attribute raw_connection.
-
#tables ⇒ Object
Returns the value of attribute tables.
Instance Method Summary collapse
- #close_transaction(_raw_tx) ⇒ Object
- #flush_transaction(_raw_tx) ⇒ Object
-
#initialize(connection_or_credentials = nil) ⇒ EntityAttributesCrudDriver
constructor
A new instance of EntityAttributesCrudDriver.
-
#open_connection(_connection_or_credentials) ⇒ Object
Default behavior is for technologies that don’t have a connection concept in a proper sense.
-
#open_transaction ⇒ Object
Default behavior is for storage technologies that don’t support proper transaction support.
- #revert_transaction(_raw_tx) ⇒ Object
- #rollback_transaction(_raw_tx) ⇒ Object
- #table_for(entity_class) ⇒ Object
Constructor Details
#initialize(connection_or_credentials = nil) ⇒ EntityAttributesCrudDriver
Returns a new instance of EntityAttributesCrudDriver.
7 8 9 10 |
# File 'foobara-0.0.110/projects/persistence/src/entity_attributes_crud_driver.rb', line 7 def initialize(connection_or_credentials = nil) self.raw_connection = open_connection(connection_or_credentials) self.tables = {} end |
Instance Attribute Details
#raw_connection ⇒ Object
Returns the value of attribute raw_connection.
5 6 7 |
# File 'foobara-0.0.110/projects/persistence/src/entity_attributes_crud_driver.rb', line 5 def raw_connection @raw_connection end |
#tables ⇒ Object
Returns the value of attribute tables.
5 6 7 |
# File 'foobara-0.0.110/projects/persistence/src/entity_attributes_crud_driver.rb', line 5 def tables @tables end |
Instance Method Details
#close_transaction(_raw_tx) ⇒ Object
34 35 |
# File 'foobara-0.0.110/projects/persistence/src/entity_attributes_crud_driver.rb', line 34 def close_transaction(_raw_tx) end |
#flush_transaction(_raw_tx) ⇒ Object
25 26 |
# File 'foobara-0.0.110/projects/persistence/src/entity_attributes_crud_driver.rb', line 25 def flush_transaction(_raw_tx) end |
#open_connection(_connection_or_credentials) ⇒ Object
Default behavior is for technologies that don’t have a connection concept in a proper sense
14 15 16 |
# File 'foobara-0.0.110/projects/persistence/src/entity_attributes_crud_driver.rb', line 14 def open_connection(_connection_or_credentials) # should we return some kind of Connection object here even if it does nothing interesting? end |
#open_transaction ⇒ Object
Default behavior is for storage technologies that don’t support proper transaction support
20 21 22 23 |
# File 'foobara-0.0.110/projects/persistence/src/entity_attributes_crud_driver.rb', line 20 def open_transaction # Should we have some kind of fake transaction object that raises errors when used after rolledback/closed? Object.new end |
#revert_transaction(_raw_tx) ⇒ Object
28 29 |
# File 'foobara-0.0.110/projects/persistence/src/entity_attributes_crud_driver.rb', line 28 def revert_transaction(_raw_tx) end |
#rollback_transaction(_raw_tx) ⇒ Object
31 32 |
# File 'foobara-0.0.110/projects/persistence/src/entity_attributes_crud_driver.rb', line 31 def rollback_transaction(_raw_tx) end |
#table_for(entity_class) ⇒ Object
37 38 39 40 41 |
# File 'foobara-0.0.110/projects/persistence/src/entity_attributes_crud_driver.rb', line 37 def table_for(entity_class) key = entity_class.full_entity_name tables[key] ||= self.class::Table.new(entity_class, self) end |