Class: SeqScanner::QueryPlan

Inherits:
Object
  • Object
show all
Defined in:
lib/seq_scanner/query_plan.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(input, result) ⇒ QueryPlan

Returns a new instance of QueryPlan.



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/seq_scanner/query_plan.rb', line 7

def initialize(input, result)
  self.sql = input[:sql]
  self.name = input[:name]
  self.binds = input[:binds].map do |bind|
    {
      name: bind.name,
      value: bind.value,
    }
  end
  self.query_plan = result
end

Instance Attribute Details

#bindsObject

Returns the value of attribute binds.



5
6
7
# File 'lib/seq_scanner/query_plan.rb', line 5

def binds
  @binds
end

#nameObject

Returns the value of attribute name.



5
6
7
# File 'lib/seq_scanner/query_plan.rb', line 5

def name
  @name
end

#query_planObject

Returns the value of attribute query_plan.



5
6
7
# File 'lib/seq_scanner/query_plan.rb', line 5

def query_plan
  @query_plan
end

#sqlObject

Returns the value of attribute sql.



5
6
7
# File 'lib/seq_scanner/query_plan.rb', line 5

def sql
  @sql
end

Instance Method Details

#validateObject



19
20
21
22
23
24
# File 'lib/seq_scanner/query_plan.rb', line 19

def validate
  return true if schema_migrations?
  return true unless seq?

  raise SeqScanDetectedError.new(self)
end