Class: Gitlab::SQL::Union

Inherits:
SetOperator show all
Defined in:
lib/gitlab/sql/union.rb

Overview

Class for building SQL UNION statements.

By default ORDER BYs are dropped from the relations as the final sort order is not guaranteed any way.

Example usage:

union = Gitlab::SQL::Union.new([user.personal_projects, user.projects])
sql   = union.to_sql

Project.where("id IN (#{sql})")

Class Method Summary collapse

Methods inherited from SetOperator

#initialize, #operator_keyword_fragment, #to_sql

Constructor Details

This class inherits a constructor from Gitlab::SQL::SetOperator

Class Method Details

.operator_keywordObject


17
18
19
# File 'lib/gitlab/sql/union.rb', line 17

def self.operator_keyword
  'UNION'
end