Module: Postjob::Queue::DatabaseInfo
- Extended by:
- DatabaseInfo
- Included in:
- DatabaseInfo
- Defined in:
- lib/postjob/queue/search/database_info.rb
Overview
This module holds cached database info, to be used by the search functions.
Instance Method Summary collapse
-
#column_types(table_name) ⇒ Object
returns a Hash of column_name => column_type.
- #table_columns(table_name) ⇒ Object
Instance Method Details
#column_types(table_name) ⇒ Object
returns a Hash of column_name => column_type. Names are available both as Symbol and as String.
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/postjob/queue/search/database_info.rb', line 7 def column_types(table_name) @column_types ||= {} @column_types[table_name] ||= begin column_info = ::Simple::SQL::Reflection.column_info(table_name) hsh = {} column_info.each do |column, rec| hsh[column.to_sym] = hsh[column.to_s] = rec.data_type end hsh end end |
#table_columns(table_name) ⇒ Object
19 20 21 22 |
# File 'lib/postjob/queue/search/database_info.rb', line 19 def table_columns(table_name) @table_columns ||= {} @table_columns[table_name] ||= Simple::SQL::Reflection.columns(table_name) end |