Sha256: 1bcd5fa28c95cdbd4b64470f3c7b2b7bd741e8ec26fc140f4a79bed8274b25a4

Contents?: true

Size: 1.04 KB

Versions: 39

Compression:

Stored size: 1.04 KB

Contents

# frozen_string_literal: true

module ActiveRecord
  module ConnectionAdapters
    module PostgreSQL
      class Column < ConnectionAdapters::Column # :nodoc:
        delegate :oid, :fmod, to: :sql_type_metadata

        def initialize(*, serial: nil, **)
          super
          @serial = serial
        end

        def serial?
          @serial
        end

        def array
          sql_type_metadata.sql_type.end_with?("[]")
        end
        alias :array? :array

        def sql_type
          super.delete_suffix("[]")
        end

        def init_with(coder)
          @serial = coder["serial"]
          super
        end

        def encode_with(coder)
          coder["serial"] = @serial
          super
        end

        def ==(other)
          other.is_a?(Column) &&
            super &&
            serial? == other.serial?
        end
        alias :eql? :==

        def hash
          Column.hash ^
            super.hash ^
            serial?.hash
        end
      end
    end
    PostgreSQLColumn = PostgreSQL::Column # :nodoc:
  end
end

Version data entries

39 entries across 39 versions & 4 rubygems

Version Path
activerecord-6.1.7.10 lib/active_record/connection_adapters/postgresql/column.rb
activerecord-6.1.7.9 lib/active_record/connection_adapters/postgresql/column.rb
activerecord-6.1.7.8 lib/active_record/connection_adapters/postgresql/column.rb
activerecord-6.1.7.7 lib/active_record/connection_adapters/postgresql/column.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/activerecord-6.1.6.1/lib/active_record/connection_adapters/postgresql/column.rb
activerecord-6.1.7.6 lib/active_record/connection_adapters/postgresql/column.rb
activerecord-6.1.7.5 lib/active_record/connection_adapters/postgresql/column.rb
activerecord-6.1.7.4 lib/active_record/connection_adapters/postgresql/column.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/activerecord-6.1.6.1/lib/active_record/connection_adapters/postgresql/column.rb
activerecord-6.1.7.3 lib/active_record/connection_adapters/postgresql/column.rb
activerecord-6.1.7.2 lib/active_record/connection_adapters/postgresql/column.rb
activerecord-6.1.7.1 lib/active_record/connection_adapters/postgresql/column.rb
activerecord-6.1.7 lib/active_record/connection_adapters/postgresql/column.rb
activerecord-6.1.6.1 lib/active_record/connection_adapters/postgresql/column.rb
activerecord-6.1.6 lib/active_record/connection_adapters/postgresql/column.rb
activerecord-6.1.5.1 lib/active_record/connection_adapters/postgresql/column.rb
activerecord-6.1.5 lib/active_record/connection_adapters/postgresql/column.rb
activerecord-6.1.4.7 lib/active_record/connection_adapters/postgresql/column.rb
activerecord-6.1.4.6 lib/active_record/connection_adapters/postgresql/column.rb
activerecord-6.1.4.5 lib/active_record/connection_adapters/postgresql/column.rb