Sha256: ad9c68cb13c950edb90d8e744e5d78c42597dfc74145d5d43cbe520a807b7a59

Contents?: true

Size: 610 Bytes

Versions: 13

Compression:

Stored size: 610 Bytes

Contents

module Rasti
  module DB
    module TypeConverters
      module PostgresTypes
        class Array

          class << self

            def column_type_regex
              /^([a-z]+)\[\]$/
            end

            def to_db(value, sub_type)
              array = sub_type == 'hstore' ? value.map { |v| Sequel.hstore v } : value
              Sequel.pg_array array, sub_type
            end

            def db_classes
              [Sequel::Postgres::PGArray]
            end

            def from_db(object)
              object.to_a
            end

          end

        end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
rasti-db-2.3.0 lib/rasti/db/type_converters/postgres_types/array.rb
rasti-db-2.2.0 lib/rasti/db/type_converters/postgres_types/array.rb
rasti-db-2.1.0 lib/rasti/db/type_converters/postgres_types/array.rb
rasti-db-2.0.1 lib/rasti/db/type_converters/postgres_types/array.rb
rasti-db-2.0.0 lib/rasti/db/type_converters/postgres_types/array.rb
rasti-db-1.5.0 lib/rasti/db/type_converters/postgres_types/array.rb
rasti-db-1.4.0 lib/rasti/db/type_converters/postgres_types/array.rb
rasti-db-1.3.1 lib/rasti/db/type_converters/postgres_types/array.rb
rasti-db-1.3.0 lib/rasti/db/type_converters/postgres_types/array.rb
rasti-db-1.2.0 lib/rasti/db/type_converters/postgres_types/array.rb
rasti-db-1.1.1 lib/rasti/db/type_converters/postgres_types/array.rb
rasti-db-1.1.0 lib/rasti/db/type_converters/postgres_types/array.rb
rasti-db-1.0.0 lib/rasti/db/type_converters/postgres_types/array.rb