Sha256: 609cc7f6c05978ca5eb69f18019e83d450a08ffa7e166a793e41e630e1bbd6bb

Contents?: true

Size: 1.42 KB

Versions: 12

Compression:

Stored size: 1.42 KB

Contents

# Copyright 2020 Google LLC
#
# Use of this source code is governed by an MIT-style
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/MIT.

# frozen_string_literal: true

module ActiveRecord
  module ConnectionAdapters
    module Spanner
      class TypeMetadata < DelegateClass(SqlTypeMetadata)
        undef to_yaml if method_defined? :to_yaml

        include Deduplicable if defined?(Deduplicable)

        attr_reader :ordinal_position, :allow_commit_timestamp, :generated

        def initialize type_metadata, ordinal_position: nil, allow_commit_timestamp: nil, generated: nil
          super type_metadata
          @ordinal_position = ordinal_position
          @allow_commit_timestamp = allow_commit_timestamp
          @generated = generated
        end

        def == other
          other.is_a?(TypeMetadata) &&
            __getobj__ == other.__getobj__ &&
            ordinal_position == other.ordinal_position &&
            allow_commit_timestamp == other.allow_commit_timestamp &&
            generated == other.generated
        end
        alias eql? ==

        def hash
          TypeMetadata.hash ^
            __getobj__.hash ^
            ordinal_position.hash ^
            allow_commit_timestamp.hash ^
            generated.hash
        end

        private

        def deduplicated
          __setobj__ __getobj__.deduplicate
          super
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
activerecord-spanner-adapter-1.6.3 lib/active_record/connection_adapters/spanner/type_metadata.rb
activerecord-spanner-adapter-1.6.2 lib/active_record/connection_adapters/spanner/type_metadata.rb
activerecord-spanner-adapter-1.6.1 lib/active_record/connection_adapters/spanner/type_metadata.rb
activerecord-spanner-adapter-1.6.0 lib/active_record/connection_adapters/spanner/type_metadata.rb
activerecord-spanner-adapter-1.5.1 lib/active_record/connection_adapters/spanner/type_metadata.rb
activerecord-spanner-adapter-1.5.0 lib/active_record/connection_adapters/spanner/type_metadata.rb
activerecord-spanner-adapter-1.4.4 lib/active_record/connection_adapters/spanner/type_metadata.rb
activerecord-spanner-adapter-1.4.3 lib/active_record/connection_adapters/spanner/type_metadata.rb
activerecord-spanner-adapter-1.4.2 lib/active_record/connection_adapters/spanner/type_metadata.rb
activerecord-spanner-adapter-1.4.1 lib/active_record/connection_adapters/spanner/type_metadata.rb
activerecord-spanner-adapter-1.4.0 lib/active_record/connection_adapters/spanner/type_metadata.rb
activerecord-spanner-adapter-1.3.1 lib/active_record/connection_adapters/spanner/type_metadata.rb