erleans / pgo

Erlang Postgres client and connection pool
Apache License 2.0
80 stars 16 forks source link

tstzrange parentheses #32

Open benbro opened 4 years ago

benbro commented 4 years ago

tstzrange in PostgreSQL:

tstzrange('2019-12-01 00:00:00+00','2019-12-02 00:00:00+00','[)')

In pgo:

{{{{2019,12,1},{0,0,0}},{{2019,12,2},{0,0,0}}},{true,false}}

Is it possible to remove one pair of parentheses to make the representation closer to PostgreSQL?

{DateTime1, DateTime2, {LowerBound, UpperBound}}

instead of

{{DateTime1, DateTime2}, {LowerBound, UpperBound}}
tsloughter commented 4 years ago

It would be a change to https://github.com/tsloughter/pg_types in pg_range.erl. I don't really have an opinion either way so would accept a PR to add support to also support this other form.

benbro commented 4 years ago

Less parentheses is less verbose to me and match the PostgreSQL structure. If you think the current form is OK, one form is better than two forms.

benbro commented 3 years ago

Do you think we should change the tstzrange parentheses before 1.0.0-rc1 to this? {DateTime1, DateTime2, {LowerBound, UpperBound}} If not, this issue can be closed.