Class: Exwiw::QueryAst::Subquery

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

Overview

Resolves a set of values on ‘where_column` to the rows’ ‘select_column` via a nested SELECT. Used as the `value` of a WhereClause whose operator is `:in_subquery`, so `–ids-column`/`–ids-field` can filter related tables through the target table’s primary key:

<table>.<fk> IN (SELECT <table_name>.<select_column>
                 FROM <table_name>
                 WHERE <table_name>.<where_column> IN (<where_values>))

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#select_columnObject

Returns the value of attribute select_column

Returns:

  • (Object)

    the current value of select_column



57
58
59
# File 'lib/exwiw/query_ast.rb', line 57

def select_column
  @select_column
end

#table_nameObject

Returns the value of attribute table_name

Returns:

  • (Object)

    the current value of table_name



57
58
59
# File 'lib/exwiw/query_ast.rb', line 57

def table_name
  @table_name
end

#where_columnObject

Returns the value of attribute where_column

Returns:

  • (Object)

    the current value of where_column



57
58
59
# File 'lib/exwiw/query_ast.rb', line 57

def where_column
  @where_column
end

#where_valuesObject

Returns the value of attribute where_values

Returns:

  • (Object)

    the current value of where_values



57
58
59
# File 'lib/exwiw/query_ast.rb', line 57

def where_values
  @where_values
end

Instance Method Details

#to_hObject



58
59
60
61
62
63
64
65
# File 'lib/exwiw/query_ast.rb', line 58

def to_h
  {
    table_name: table_name,
    select_column: select_column,
    where_column: where_column,
    where_values: where_values,
  }
end