Class: ActiveRecord::HierarchicalQuery::CTE::QueryBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/active_record/hierarchical_query/cte/query_builder.rb

Overview

CTE query builder

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(query, options: {}) ⇒ QueryBuilder

Returns a new instance of QueryBuilder.



20
21
22
23
24
25
# File 'lib/active_record/hierarchical_query/cte/query_builder.rb', line 20

def initialize(query, options: {})
  @query = query
  @columns = Columns.new(@query)
  @cycle_detector = CycleDetector.new(@query)
  @options = options
end

Instance Attribute Details

#columnsObject (readonly)

Returns the value of attribute columns.



12
13
14
# File 'lib/active_record/hierarchical_query/cte/query_builder.rb', line 12

def columns
  @columns
end

#cycle_detectorObject (readonly)

Returns the value of attribute cycle_detector.



12
13
14
# File 'lib/active_record/hierarchical_query/cte/query_builder.rb', line 12

def cycle_detector
  @cycle_detector
end

#optionsObject (readonly)

Returns the value of attribute options.



12
13
14
# File 'lib/active_record/hierarchical_query/cte/query_builder.rb', line 12

def options
  @options
end

#queryObject (readonly)

Returns the value of attribute query.



12
13
14
# File 'lib/active_record/hierarchical_query/cte/query_builder.rb', line 12

def query
  @query
end

Instance Method Details

#bind_valuesObject



27
28
29
# File 'lib/active_record/hierarchical_query/cte/query_builder.rb', line 27

def bind_values
  union_term.bind_values
end

#build_arelArel::SelectManager

Returns:

  • (Arel::SelectManager)


32
33
34
35
36
37
38
39
# File 'lib/active_record/hierarchical_query/cte/query_builder.rb', line 32

def build_arel
  build_manager
  build_select
  build_limits
  build_order

  @arel
end