class YeSQL::Query::Performer

Attributes

bind_statement[R]
file_path[R]
named_bindings[R]
output[R]
prepare[R]

Public Class Methods

new(bind_statement:, file_path:, bindings: {}, output: :rows, prepare: false) click to toggle source
# File lib/yesql/query/performer.rb, line 16
def initialize(bind_statement:, file_path:, bindings: {}, output: :rows, prepare: false)
  @bind_statement = bind_statement
  @file_path = file_path
  @named_bindings = bindings.transform_keys(&:to_sym)
  @output = ::YeSQL::Params::Output.new(output)
  @prepare = prepare
end

Public Instance Methods

call() click to toggle source
# File lib/yesql/query/performer.rb, line 24
def call
  ::YeSQL::Query::TransformResult.new(output: output, result: query_result).call
end

Private Instance Methods

binds() click to toggle source
# File lib/yesql/query/performer.rb, line 39
def binds
  ::YeSQL::Bindings::Transformed.new(statement_binds: statement_binds(extractor)).call
end
extractor() click to toggle source
# File lib/yesql/query/performer.rb, line 43
def extractor
  ::YeSQL::Bindings::Extractor.new(bindings: named_bindings).call
end
query_result() click to toggle source
# File lib/yesql/query/performer.rb, line 32
def query_result
  @query_result ||= ::YeSQL::Query::Result.new(binds: binds,
                                               bind_statement: bind_statement,
                                               file_path: file_path,
                                               prepare: prepare).call
end