Welcome to mirror list, hosted at ThFree Co, Russian Federation.

base.rb « schema_objects « validation « schema « gitlab « lib « gitlab-schema-validation « gems - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 1af7a67ddb623d92ebdf1c1f7f3bdec6a23beb9a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# frozen_string_literal: true

module Gitlab
  module Schema
    module Validation
      module SchemaObjects
        class Base
          def initialize(parsed_stmt)
            @parsed_stmt = parsed_stmt
          end

          def name
            raise NoMethodError, "subclasses of #{self.class.name} must implement #{__method__}"
          end

          def table_name
            parsed_stmt.relation.relname
          end

          def statement
            @statement ||= PgQuery.deparse_stmt(parsed_stmt)
          end

          private

          attr_reader :parsed_stmt
        end
      end
    end
  end
end