Module: Sequel::Extensions::Combine
- Defined in:
- lib/sequel/extensions/combine.rb
Constant Summary collapse
- ALLOWED_TYPES =
%i[many one].freeze
- AGGREGATED_ROW_ALIAS =
:ROW
Instance Method Summary collapse
Instance Method Details
#combine(options) ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/sequel/extensions/combine.rb', line 11 def combine() raise Sequel::DatabaseError, "Invalid adapter. PostgreSQL driver not found." unless Sequel::Postgres::USES_PG column_mappings = .map { |type, relations| combine_columns(type, relations) } column_mapping = column_mappings.reduce({}, :merge) select_append do column_mapping.map { |column_name, query| query.as(column_name.to_sym) } end end |