Module: ROM::SQL::Types::PG

Defined in:
lib/rom/sql/extensions/postgres/types.rb

Defined Under Namespace

Classes: Point

Constant Summary collapse

UUID =

UUID

Types::String
Array =

Array

Dry::Types::Definition
.new(Sequel::Postgres::PGArray)
JSONArray =

JSON

Types.Constructor(Sequel::Postgres::JSONArray, &Sequel.method(:pg_json))
JSONHash =
Types.Constructor(Sequel::Postgres::JSONArray, &Sequel.method(:pg_json))
JSONOp =
Types.Constructor(Sequel::Postgres::JSONOp, &Sequel.method(:pg_json))
JSON =
JSONArray | JSONHash | JSONOp
JSONBArray =

JSONB

Types.Constructor(Sequel::Postgres::JSONBArray, &Sequel.method(:pg_jsonb))
JSONBHash =
Types.Constructor(Sequel::Postgres::JSONBHash, &Sequel.method(:pg_jsonb))
JSONBOp =
Types.Constructor(Sequel::Postgres::JSONBOp, &Sequel.method(:pg_jsonb))
JSONB =
JSONBArray | JSONBHash | JSONBOp
Bytea =
Types.Constructor(Sequel::SQL::Blob, &Sequel::SQL::Blob.method(:new))
IPAddressR =
Types.Constructor(IPAddr) { |ip| IPAddr.new(ip.to_s) }
IPAddress =
Types.Constructor(IPAddr, &:to_s).meta(read: IPAddressR)
Money =
Types::Decimal
PointTR =
Types.Constructor(Point) do |p|
  x, y = p.to_s[1...-1].split(',', 2)
  Point.new(Float(x), Float(y))
end
PointT =
Types.Constructor(Point) { |p| "(#{ p.x },#{ p.y })" }.meta(read: PointTR)

Class Method Summary collapse

Class Method Details

.Array(db_type) ⇒ Object



20
21
22
# File 'lib/rom/sql/extensions/postgres/types.rb', line 20

def self.Array(db_type)
  Array.constructor(-> (v) { Sequel.pg_array(v, db_type) }).meta(type: db_type)
end