-
Notifications
You must be signed in to change notification settings - Fork 2
types
Alexey Borzov edited this page Sep 18, 2020
·
5 revisions
The following is a list of base type converters available via DefaultTypeConverterFactory
. Note the following when reading the table:
-
sad_spirit\pg_wrapper
namespace prefix is assumed in all relative class names. - "Compatible
array
" is an array that will be accepted bycreateFromArray()
method of type's class. - Type names listed are PostgreSQL's internal, corresponding to rows in
pg_catalog.pg_type
. SQL-standard names are also understood. -
converters\containers\CompositeConverter
,converters\containers\ArrayConverter
, andconverters\containers\RangeConverter
are used to convert composite, array, and range types, they are configured with instances of base type converters. - Built-in range types are only registered explicitly to be able to get the converter by name easily.
Type names | TypeConverter implementation |
input() returns |
output() accepts |
---|---|---|---|
bool |
converters\BooleanConverter |
bool |
anything, PHP values evaluating to false and strings 'false' and 'f' are converted to 'f' , everything else to 't'
|
bytea |
converters\ByteaConverter |
string |
string |
oid , cid , xid , int2 , int4 , int8
|
converters\IntegerConverter |
int , string if integer is out of range for PHP (e.g. int8 type on 32-bit PHP) |
numeric values |
numeric |
converters\NumericConverter |
string , to prevent loss of precision |
numeric values |
float4 , float8 , money
|
converters\FloatConverter |
double |
numeric values |
date |
converters\datetime\DateConverter |
\DateTimeImmutable |
string (passed as is), int (treated as Unix timestamp), \DateTimeInterface
|
time |
converters\datetime\TimeConverter |
--"-- | --"-- |
timetz |
converters\datetime\TimeTzConverter |
--"-- | --"-- |
timestamp |
converters\datetime\TimeStampConverter |
--"-- | --"-- |
timestamptz , abstime
|
converters\datetime\TimeStampTzConverter |
--"-- | --"-- |
interval , reltime
|
converters\datetime\IntervalConverter |
types\DateInterval |
string (passed as is), int , double (treated as number of seconds), \DateInterval
|
cstring , text , char , varchar , bpchar , name
|
converters\StringConverter |
string |
string |
tid |
converters\TidConverter |
types\Tid |
types\Tid or compatible array
|
json , jsonb
|
converters\JSONConverter |
usually an array | anything json_encode() can handle |
point |
converters\geometric\PointConverter |
types\Point |
types\Point or compatible array
|
circle |
converters\geometric\CircleConverter |
types\Circle |
types\Circle or compatible array
|
line |
converters\geometric\LineConverter |
types\Line |
types\Line or compatible array
|
lseg |
converters\geometric\LSegConverter |
types\LineSegment |
types\LineSegment or compatible array
|
box |
converters\geometric\BoxConverter |
types\Box |
types\Box or compatible array
|
path |
converters\geometric\PathConverter |
types\Path |
types\Path or compatible array
|
polygon |
converters\geometric\PolygonConverter |
types\Polygon |
types\Polygon or compatible array
|
int4range , int8range
|
converters\containers\RangeConverter with converters\IntegerConverter
|
types\NumericRange |
types\Range or compatible array
|
numrange |
converters\containers\RangeConverter with converters\NumericConverter
|
--"-- | --"-- |
daterange |
converters\containers\RangeConverter with converters\datetime\DateConverter
|
types\DateTimeRange |
--"-- |
tsrange |
converters\containers\RangeConverter with converters\datetime\TimeStampConverter
|
--"-- | --"-- |
tstzrange |
converters\containers\RangeConverter with converters\datetime\TimeStampTzConverter
|
--"-- | --"-- |
hstore (from contrib/hstore extension) |
converters\containers\HstoreConverter |
array |
array or object
|