Sha256: a8be819c861a4f1b0d6d04c0916c7f32ab909d5561b87772a950cdba1d3d308e

Contents?: true

Size: 516 Bytes

Versions: 28

Compression:

Stored size: 516 Bytes

Contents

# frozen_string_literal: true

module TableSync::NamingResolver
  class Sequel
    def initialize(table_name:, db:)
      @table_name = table_name
      @db = db
    end

    def table
      table_name.is_a?(::Sequel::SQL::QualifiedIdentifier) ? table_name.column : table_name
    end

    def schema
      return table_name.table if table_name.is_a?(::Sequel::SQL::QualifiedIdentifier)
      db.get(Sequel.function("current_schema")) rescue "public"
    end

    private

    attr_reader :table_name, :db
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
table_sync-6.5.1 lib/table_sync/naming_resolver/sequel.rb
table_sync-6.5.0 lib/table_sync/naming_resolver/sequel.rb
table_sync-6.4.2 lib/table_sync/naming_resolver/sequel.rb
table_sync-6.4.1 lib/table_sync/naming_resolver/sequel.rb
table_sync-6.4.0 lib/table_sync/naming_resolver/sequel.rb
table_sync-6.3.0 lib/table_sync/naming_resolver/sequel.rb
table_sync-6.1.0 lib/table_sync/naming_resolver/sequel.rb
table_sync-6.0.4 lib/table_sync/naming_resolver/sequel.rb
table_sync-6.0.3 lib/table_sync/naming_resolver/sequel.rb
table_sync-6.0.2 lib/table_sync/naming_resolver/sequel.rb
table_sync-6.0 lib/table_sync/naming_resolver/sequel.rb
table_sync-5.1.0 lib/table_sync/naming_resolver/sequel.rb
table_sync-5.0.0 lib/table_sync/naming_resolver/sequel.rb
table_sync-4.2.2 lib/table_sync/naming_resolver/sequel.rb
table_sync-4.2.1 lib/table_sync/naming_resolver/sequel.rb
table_sync-4.2.0 lib/table_sync/naming_resolver/sequel.rb
table_sync-4.1.3 lib/table_sync/naming_resolver/sequel.rb
table_sync-4.1.1 lib/table_sync/naming_resolver/sequel.rb
table_sync-4.1.0 lib/table_sync/naming_resolver/sequel.rb
table_sync-4.0.0 lib/table_sync/naming_resolver/sequel.rb