lib/enrichment_db.rb in enrichment_db-0.1.9 vs lib/enrichment_db.rb in enrichment_db-0.1.10
- old
+ new
@@ -36,9 +36,20 @@
record
end
format_result(result)
end
+
+ def self.by_lambda(schema_name, table_name, condition)
+ puts "Finding object from #{table_name} with condition #{condition}."
+ query = "SELECT * FROM #{schema_name}.#{table_name} where #{condition}"
+
+ result = EnrichmentDb.request(schema_name, query).collect do |record|
+ record
+ end
+
+ format_result(result)
+ end
def self.all(table_name, schema_name = nil)
schema_name = schema_name || self::DATABASE_NAME
puts "Finding all objects from #{table_name}"
query = "SELECT * FROM #{schema_name}.#{table_name}"
\ No newline at end of file