pg_inet.rb

Path: lib/sequel/extensions/pg_inet.rb
Last Update: Thu Nov 12 08:45:04 +0000 2015

The pg_inet extension adds support for Sequel to handle PostgreSQL‘s inet and cidr types using ruby‘s IPAddr class.

This extension integrates with Sequel‘s native postgres and jdbc/postgresql adapters, so that when inet/cidr fields are retrieved, they are returned as IPAddr instances

To use this extension, load it into your database:

  DB.extension :pg_inet

If you are not using the native postgres or jdbc/postgresql adapters and are using inet/cidr types as model column values you probably should use the pg_typecast_on_load plugin if the column values are returned as a string.

This extension integrates with the pg_array extension. If you plan to use the inet[] or cidr[] types, load the pg_array extension before the pg_inet extension:

  DB.extension :pg_array, :pg_inet

This extension does not add special support for the macaddr type. Ruby doesn‘t have a stdlib class that represents mac addresses, so these will still be returned as strings. The exception to this is that the pg_array extension integration will recognize macaddr[] types return them as arrays of strings.

See the schema modification guide for details on using inet/cidr columns in CREATE/ALTER TABLE statements.

Required files

ipaddr   adapters/utils/pg_types  

[Validate]