Module: DbAgile::SequelAdapter::Data::TableDriven
- Included in:
- DbAgile::SequelAdapter
- Defined in:
- lib/dbagile/adapter/sequel/data/table_driven.rb
Instance Method Summary collapse
Instance Method Details
#dataset(table, proj = nil) ⇒ Object
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/dbagile/adapter/sequel/data/table_driven.rb', line 7 def dataset(table, proj = nil) result = case table when Symbol (proj.nil? or proj.empty?) ? db[table] : db[table].where(proj) else (proj.nil? or proj.empty?) ? db[table] : db[table].where(proj) end result.extend(::DbAgile::Contract::Data::Dataset) result end |
#exists?(table_or_query, subtuple = {}) ⇒ Boolean
19 20 21 22 23 24 25 |
# File 'lib/dbagile/adapter/sequel/data/table_driven.rb', line 19 def exists?(table_or_query, subtuple = {}) if subtuple.nil? or subtuple.empty? !dataset(table_or_query).empty? else !dataset(table_or_query).where(subtuple).empty? end end |