Sha256: 8c031586845a43a80fa688338dcd6d1c987401cdeb95d61dc339cf5e953f0d34
Contents?: true
Size: 1 KB
Versions: 3
Compression:
Stored size: 1 KB
Contents
require 'sequel/core' require 'rom/sql/type_extensions' Sequel.extension(:pg_hstore) module ROM module SQL module Postgres module Types def self.Type(name, type = yield) type.meta(db_type: name, database: 'postgres') end UUID = Type('uuid', SQL::Types::String) HStore = Type('hstore') do read = SQL::Types.Constructor(Hash, &:to_hash) SQL::Types.Constructor(Hash, &Sequel.method(:hstore)) .meta(read: read) end Bytea = Type('bytea') do SQL::Types.Constructor(Sequel::SQL::Blob, &Sequel::SQL::Blob.method(:new)) end Money = Type('money', SQL::Types::Decimal) XML = Type('xml', SQL::Types::String) end end module Types PG = Postgres::Types end end end require 'rom/sql/extensions/postgres/types/array' require 'rom/sql/extensions/postgres/types/json' require 'rom/sql/extensions/postgres/types/geometric' require 'rom/sql/extensions/postgres/types/network'
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rom-sql-2.0.0 | lib/rom/sql/extensions/postgres/types.rb |
rom-sql-2.0.0.rc1 | lib/rom/sql/extensions/postgres/types.rb |
rom-sql-2.0.0.beta3 | lib/rom/sql/extensions/postgres/types.rb |