Module: ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::OID

Defined in:
lib/active_record/connection_adapters/postgresql/oid.rb

Defined Under Namespace

Classes: Array, Bit, Boolean, Bytea, Cidr, Date, Decimal, Float, Hstore, Identity, Integer, Json, Money, Point, Range, Time, Timestamp, Type, TypeMap, Vector

Constant Summary collapse

NAMES =

When the PG adapter connects, the pg_type table is queried. The key of this hash maps to the ‘typname` column from the table. type_map is then dynamically built with oids as the key and type objects as values.

Hash.new { |h,k| # :nodoc:
  h[k] = OID::Identity.new
}

Class Method Summary collapse

Class Method Details

.alias_type(new, old) ⇒ Object

Alias the old type to the new type.



331
332
333
# File 'lib/active_record/connection_adapters/postgresql/oid.rb', line 331

def self.alias_type(new, old)
  NAMES[new] = NAMES[old]
end

.register_type(name, type) ⇒ Object

Register an OID type named name with a typecasting object in type. name should correspond to the ‘typname` column in the `pg_type` table.



326
327
328
# File 'lib/active_record/connection_adapters/postgresql/oid.rb', line 326

def self.register_type(name, type)
  NAMES[name] = type
end

.registered_type?(name) ⇒ Boolean

Is name a registered type?

Returns:



336
337
338
# File 'lib/active_record/connection_adapters/postgresql/oid.rb', line 336

def self.registered_type?(name)
  NAMES.key? name
end