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

TYPE_MAP =

:nodoc:

TypeMap.new
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.



310
311
312
# File 'lib/active_record/connection_adapters/postgresql/oid.rb', line 310

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

.register_type(name, type) ⇒ Object

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



305
306
307
# File 'lib/active_record/connection_adapters/postgresql/oid.rb', line 305

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

.registered_type?(name) ⇒ Boolean

Is name a registered type?

Returns:



315
316
317
# File 'lib/active_record/connection_adapters/postgresql/oid.rb', line 315

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