debian-mirror-gitlab/lib/gitlab/sql/union.rb

23 lines
526 B
Ruby
Raw Normal View History

2019-02-15 15:39:39 +05:30
# frozen_string_literal: true
2015-11-26 14:37:03 +05:30
module Gitlab
module SQL
# Class for building SQL UNION statements.
#
2021-04-29 21:17:54 +05:30
# By default ORDER BYs are dropped from the relations as the final sort
# order is not guaranteed any way.
2015-11-26 14:37:03 +05:30
#
# Example usage:
#
2019-03-02 22:35:43 +05:30
# union = Gitlab::SQL::Union.new([user.personal_projects, user.projects])
2015-11-26 14:37:03 +05:30
# sql = union.to_sql
#
# Project.where("id IN (#{sql})")
2020-11-24 15:15:51 +05:30
class Union < SetOperator
def self.operator_keyword
'UNION'
2015-11-26 14:37:03 +05:30
end
end
end
end