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.



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

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.



320
321
322
# File 'lib/active_record/connection_adapters/postgresql/oid.rb', line 320

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

.registered_type?(name) ⇒ Boolean

Is name a registered type?

Returns:



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

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