Module: Torque::PostgreSQL::Arel::Visitors

Defined in:
lib/torque/postgresql/arel/visitors.rb

Instance Method Summary collapse

Instance Method Details

#visit_Arel_Nodes_JoinSource(o, collector) ⇒ Object

Add ONLY modifier to query



8
9
10
11
# File 'lib/torque/postgresql/arel/visitors.rb', line 8

def visit_Arel_Nodes_JoinSource(o, collector)
  collector << 'ONLY ' if o.only?
  super
end

#visit_Arel_Nodes_Quoted(o, collector) ⇒ Object

Allow quoted arrays to get here



14
15
16
17
# File 'lib/torque/postgresql/arel/visitors.rb', line 14

def visit_Arel_Nodes_Quoted(o, collector)
  return super unless o.expr.is_a?(::Enumerable)
  quote_array(o.expr, collector)
end

#visit_Torque_PostgreSQL_Arel_Nodes_Cast(o, collector) ⇒ Object

Allow casting any node



44
45
46
# File 'lib/torque/postgresql/arel/visitors.rb', line 44

def visit_Torque_PostgreSQL_Arel_Nodes_Cast(o, collector)
  visit(o.left, collector) << '::' << o.right
end

#visit_Torque_PostgreSQL_Arel_Nodes_Column(o, collector) ⇒ Object

Access a single column of a composite value



25
26
27
28
29
# File 'lib/torque/postgresql/arel/visitors.rb', line 25

def visit_Torque_PostgreSQL_Arel_Nodes_Column(o, collector)
  collector << '('
  visit(o.left, collector)
  collector << ').' << quote_column_name(o.right)
end

#visit_Torque_PostgreSQL_Arel_Nodes_Property(o, collector) ⇒ Object

Access a single property of a document, as text, so that it can then be casted to whatever the property is supposed to be



33
34
35
36
37
38
39
40
41
# File 'lib/torque/postgresql/arel/visitors.rb', line 33

def visit_Torque_PostgreSQL_Arel_Nodes_Property(o, collector)
  collector << '('
  visit(o.left, collector)
  collector << ' #>> '
  visit(::Arel.array(o.path), collector)
  collector << ')'
  collector << '::' << o.cast if o.cast
  collector
end

#visit_Torque_PostgreSQL_Arel_Nodes_Ref(o, collector) ⇒ Object

TORQUE VISITORS



20
21
22
# File 'lib/torque/postgresql/arel/visitors.rb', line 20

def visit_Torque_PostgreSQL_Arel_Nodes_Ref(o, collector)
  collector << quote_table_name(o.expr)
end