posterize

Build Status

an erlang wrapper for postgrex

documentation at hexdocs

data representation

postgres        erlang
----------      ------
NULL            nil
bool            true | false
char            <<"é">>
int             42
float           42.0
text            <<"hallo world">>
bytea           <<42>>
date            {2016, 2, 3} :: {year(), month(), day()}
time            {15, 17, 45.3} :: {hour(), min(), sec()}
timestamp       {{2016, 2, 3}, {15, 17, 45}} :: {{year(), month(), day()}, {hour(), min(), sec()}}
interval        {{6, 7, 8}, 302, 7} :: {{hour(), min(), sec()}, day(), month()}
array           [1, 2, 3]
composite type  {42, <<"title">>, <<"content">>}
uuid            <<160,238,188,153,156,11,78,248,187,109,107,185,189,56,10,17>>
hstore          #{<<"foo">> => <<"bar">>}

todo

  • ranges, numerics, time zones and all the other missing data types
  • figure out how to encode/decode undefined instead of nil
  • more tests, especially integration

acknowledgments

this thing definotely wouldn’t exist without ericmj and fishcakez. all credit to them