Class: QueryConsole::SchemaIntrospector

Inherits:
Object
  • Object
show all
Defined in:
app/services/query_console/schema_introspector.rb

Instance Method Summary collapse

Constructor Details

#initialize(config = QueryConsole.configuration) ⇒ SchemaIntrospector

Returns a new instance of SchemaIntrospector.



3
4
5
# File 'app/services/query_console/schema_introspector.rb', line 3

def initialize(config = QueryConsole.configuration)
  @config = config
end

Instance Method Details

#table_details(table_name) ⇒ Object



15
16
17
18
19
20
21
22
# File 'app/services/query_console/schema_introspector.rb', line 15

def table_details(table_name)
  return nil unless @config.schema_explorer
  return nil if table_denied?(table_name)

  Rails.cache.fetch(cache_key_table(table_name), expires_in: @config.schema_cache_seconds) do
    fetch_table_details(table_name)
  end
end

#tablesObject



7
8
9
10
11
12
13
# File 'app/services/query_console/schema_introspector.rb', line 7

def tables
  return [] unless @config.schema_explorer

  Rails.cache.fetch(cache_key_tables, expires_in: @config.schema_cache_seconds) do
    fetch_tables
  end
end