Module: TalkToYourApp::Plugins::Db

Defined in:
lib/talk_to_your_app/plugins/db/plugin.rb,
lib/talk_to_your_app/plugins/db/tools/query.rb,
lib/talk_to_your_app/plugins/db/tools/schema.rb,
lib/talk_to_your_app/plugins/db/tools/tables.rb

Defined Under Namespace

Modules: Tools Classes: Plugin

Constant Summary collapse

DEFAULT_MAX_ROWS =

Default cap on rows returned by db.query. Override per app with ‘config.plugin :db, max_rows: 5000`, or disable the cap entirely with `max_rows: nil` (also accepts false or :unlimited).

2000
UNLIMITED =
[nil, false, :unlimited].freeze

Class Method Summary collapse

Class Method Details

.max_rowsObject

Returns the row cap as an Integer, or nil for “no cap”.



20
21
22
23
24
25
26
27
28
# File 'lib/talk_to_your_app/plugins/db/plugin.rb', line 20

def max_rows
  options = TalkToYourApp.configuration.enabled_plugins[:db] || {}
  return DEFAULT_MAX_ROWS unless options.key?(:max_rows)

  value = options[:max_rows]
  return nil if UNLIMITED.include?(value)

  Integer(value)
end