summaryrefslogtreecommitdiff
path: root/lib/gitlab/sql/except.rb
blob: 82cbfa8d4ab6112f0a9187639459f9f921550825 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# frozen_string_literal: true

module Gitlab
  module SQL
    # Class for building SQL EXCEPT statements.
    #
    # ORDER BYs are dropped from the relations as the final sort order is not
    # guaranteed any way.
    #
    # Example usage:
    #
    #     except = Gitlab::SQL::Except.new([user.projects, user.personal_projects])
    #     sql    = except.to_sql
    #
    #     Project.where("id IN (#{sql})")
    class Except < SetOperator
      def self.operator_keyword
        'EXCEPT'
      end
    end
  end
end