module NoBrainer::QueryRunner

Public Class Methods

em_stack() click to toggle source
# File lib/no_brainer/query_runner.rb, line 45
def em_stack
  @em_stack ||= ::Middleware::Builder.new do
    use RunOptions
    use MissingIndex
    use DatabaseOnDemand
    use TableOnDemand
    use Profiler
    use WriteError
    use Reconnect
    use EMDriver
  end
end
normal_stack() click to toggle source
# File lib/no_brainer/query_runner.rb, line 31
def normal_stack
  @normal_stack ||= ::Middleware::Builder.new do
    use RunOptions
    use MissingIndex
    use DatabaseOnDemand
    use TableOnDemand
    use Profiler
    use WriteError
    use ConnectionLock
    use Reconnect
    use Driver
  end
end
run(*args, &block) click to toggle source
# File lib/no_brainer/query_runner.rb, line 17
def run(*args, &block)
  options = args.extract_options!
  raise ArgumentError unless args.size == 1 || block
  query = args.first || block.call(RethinkDB::RQL.new)
  stack.call(:query => query, :options => options)
end
stack() click to toggle source
# File lib/no_brainer/query_runner.rb, line 24
def stack
  case NoBrainer::Config.driver
  when :regular then normal_stack
  when :em      then em_stack
  end
end