Class: Exwiw::QueryAst::SelectSubquery

Inherits:
Struct
  • Object
show all
Defined in:
lib/exwiw/query_ast.rb

Overview

A subquery whose body is a full Select, projected down to a single column. Unlike the flat Subquery above (one column = one IN-list), this carries the referencing table's complete extraction query — joins, multiple where conditions, polymorphic type filters and all. Used by the reverse / "referenced_by" extraction so a parent table with no belongs_to path to the dump target (e.g. active_storage_blobs) is constrained to only the rows referenced by an extractable child table:

<parent>.<pk> IN (SELECT <child>.<fk> FROM <child> WHERE <child filters>)

query is the child's Select already projected to the foreign-key column that points at the parent.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#queryObject

Returns the value of attribute query

Returns:

  • (Object)

    the current value of query



104
105
106
# File 'lib/exwiw/query_ast.rb', line 104

def query
  @query
end

Instance Method Details

#to_hObject



105
106
107
# File 'lib/exwiw/query_ast.rb', line 105

def to_h
  { query: query.to_h }
end