24 Commits

Author SHA1 Message Date
Jack Christensen
dd160540c4 Use Go 1.13 errors instead of xerrors 2021-03-25 09:08:27 -04:00
Jack Christensen
0f1bda20b0 Fix numeric NaN support
fixes #93
2021-03-11 19:49:03 -06:00
megaturbo
3105c6e706 Add support for nullable types in Value.Get implementations 2020-06-17 17:04:43 +02:00
Jack Christensen
7bcd9fbdaf Rename IsNaN to NaN 2020-06-11 21:35:32 -05:00
leighhopcroft
0b762c6e26 updated to use boolean IsNaN field on Numeric 2020-06-10 16:59:08 +01:00
leighhopcroft
f2a2797a88 support NaN in Numeric encode and decode methods 2020-06-02 20:14:51 +01:00
leighhopcroft
b708c8b985 support NaN in Numeric.AssignTo 2020-06-02 19:07:10 +01:00
leighhopcroft
3cbb81631a added NaN support to Numeric.Set 2020-06-02 18:35:58 +01:00
Jack Christensen
238967ec4e Improve accuracy of numeric to float
fixes #27
2020-05-13 08:05:19 -05:00
Jack Christensen
55a56add23 Set will call Get on src if possible 2020-02-19 11:58:49 -06:00
Jack Christensen
f3816bd1c0 Get implemented on T instead of *T
Methods defined on T are also available on *T. Thought this technically
changes the interface, because *T will be automatically dereferenced as
needed it shouldn't be a breaking change.

See a8802b16cc593842f5c69b0f7cfb0de11d5cd3a8 for similar change.
2020-02-19 10:48:09 -06:00
Jack Christensen
a8802b16cc Value, EncodeBinary, EncodeText, and MarshalJSON on T instead of *T
Methods defined on T are also available on *T. This change makes Value
consistent with database/sql Value implementations. It also makes Value,
EncodeBinary, and EncodeText more convenient to use because you can
pass T or *T as an argument to a query.

The MarshalJSON change is even more significant because without it
json.Marshal would generate the "%v" format instead of the implemented
MarshalJSON.

Thought this technically changes the interface, because *T will be
automatically dereferenced as needed it shouldn't be a breaking change.

See: https://github.com/jackc/pgx/issues/538 for initial discussion.
2019-08-27 20:46:16 -05:00
Jack Christensen
4e0ed911f5 Import Fix for -0 numeric
From pgx: d678216f468d1fe4dc28649feacd4b30a176769e
2019-06-08 11:45:47 -05:00
Jack Christensen
f25878662d Use golang.org/x/xerrors 2019-04-20 17:43:44 -05:00
Jack Christensen
78eda7d567 Remove unused scan float into numeric 2019-04-13 18:06:09 -05:00
Jack Christensen
4e79a104f7 Test domains when registered and unregistered
Fix bug assigning to unknown type.
2019-04-13 17:09:51 -05:00
Jack Christensen
0ac82007fb Use extracted packages with Go modules 2019-04-05 10:59:47 -05:00
Wei Congrui
f18a22e066 Fix numeric EncodeBinary bug 2017-08-18 15:20:39 +08:00
Jack Christensen
a5f166bd21 Use github.com/pkg/errors 2017-06-04 21:30:03 -05:00
Jack Christensen
6b906ca870 Refactor pgio and types to append buffers 2017-05-02 20:38:26 -05:00
Jack Christensen
ab21bc4ec7 pgtype DecodeText and DecodeBinary do not copy
They now take ownership of the src argument.

Needed to change Scan to make a copy of []byte arguments as lib/pq apparently
gives Scan a shared memory buffer.
2017-04-29 12:23:51 -05:00
Jack Christensen
b49035fdc1 Add shopspring.Numeric
This adds PostgreSQL numeric mapping to and from
github.com/shopspring/decimal.

Makes pgtype.NullAssignTo public as external types need this functionality.

Begin extraction of pgtype testing functionality so it can easily be used by
external types.
2017-04-14 12:24:44 -05:00
Jack Christensen
7ff405ff84 Add simple protocol suuport with (Query|Exec)Ex 2017-04-10 08:58:51 -05:00
Jack Christensen
f7191d3a56 Add pgtype.Numeric 2017-04-01 23:33:04 -05:00