Sha256: f4138e8bbf99661e66a06ca60bb5708ce7e20217a1928d1cabfe27795bda5cb1

Contents?: true

Size: 964 Bytes

Versions: 5

Compression:

Stored size: 964 Bytes

Contents

# Copyright 2022 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 Column < ConnectionAdapters::Column
        # rubocop:disable Style/MethodDefParentheses
        def initialize(name, default, sql_type_metadata = nil, null = true,
                       default_function = nil, collation: nil, comment: nil,
                       primary_key: false, **)
          # rubocop:enable Style/MethodDefParentheses
          super
          @primary_key = primary_key
        end

        def has_default? # rubocop:disable Naming/PredicateName
          super && !virtual?
        end

        def virtual?
          sql_type_metadata.generated
        end

        def primary_key?
          @primary_key
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
activerecord-spanner-adapter-1.8.0 lib/active_record/connection_adapters/spanner/column.rb
activerecord-spanner-adapter-1.6.3 lib/active_record/connection_adapters/spanner/column.rb
activerecord-spanner-adapter-1.6.2 lib/active_record/connection_adapters/spanner/column.rb
activerecord-spanner-adapter-1.6.1 lib/active_record/connection_adapters/spanner/column.rb
activerecord-spanner-adapter-1.6.0 lib/active_record/connection_adapters/spanner/column.rb