Class: Torque::PostgreSQL::AuxiliaryStatement::Recursive

Inherits:
Torque::PostgreSQL::AuxiliaryStatement show all
Defined in:
lib/torque/postgresql/auxiliary_statement/recursive.rb

Constant Summary

Constants inherited from Torque::PostgreSQL::AuxiliaryStatement

TABLE_COLUMN_AS_STRING

Instance Attribute Summary

Attributes inherited from Torque::PostgreSQL::AuxiliaryStatement

#bound_attributes, #join_sources

Instance Method Summary collapse

Methods inherited from Torque::PostgreSQL::AuxiliaryStatement

arel_query?, #build, build, configurator, configure, create, instantiate, lookup, relation_query?, table

Constructor Details

#initialize(**options) ⇒ Recursive

Setup any additional option in the recursive mode



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/torque/postgresql/auxiliary_statement/recursive.rb', line 8

def initialize(*, **options)
  super

  @connect = options[:connect]&.to_a&.first
  @union_all = options[:union_all]
  @sub_query = options[:sub_query]

  if options.key?(:with_depth)
    @depth = options[:with_depth].values_at(:name, :start, :as)
    @depth[0] ||= 'depth'
  end

  if options.key?(:with_path)
    @path = options[:with_path].values_at(:name, :source, :as)
    @path[0] ||= 'path'
  end
end