Module: DbAgile::Contract::Data::TableDriven

Included in:
Utils::Full
Defined in:
lib/dbagile/contract/data/table_driven.rb

Overview

Table driven methods of the contract

Instance Method Summary collapse

Instance Method Details

#dataset(table_or_query, proj = nil) ⇒ ...

Returns a dataset object for a given table (if a Symbol is given) or query (if a String is given).

As DbAgile aims at helping to manage SQL database access with respect to their schema, it does not specifies a detailed contract about the object returned here, which is related to queries, not schema modification. The kind of returned object is therefore left open to adapter specfic implementations.

We expect (mainly for tests) the following about datasets:

  • count: returns the number of records inside the dataset
  • to_a: returns an array of hashes representing records


28
29
30
# File 'lib/dbagile/contract/data/table_driven.rb', line 28

def dataset(table_or_query, proj = nil)
  Kernel.raise NotImplementedError
end

#exists?(table_or_query, subtuple = {}) ⇒ Boolean

Checks if a (sub)-tuple exists inside a table.



42
43
44
# File 'lib/dbagile/contract/data/table_driven.rb', line 42

def exists?(table_or_query, subtuple = {})
  Kernel.raise NotImplementedError
end