module Postjob::Queue::DatabaseInfo
This module holds cached database info, to be used by the search functions.
Private Instance Methods
column_types(table_name)
click to toggle source
returns a Hash of column_name => column_type. Names are available both as Symbol and as String.
# 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)
click to toggle source
# 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