Commit Graph

20 Commits (821e0521e464a4f88219ba97c1d4be77c15cd8e8)

Author SHA1 Message Date
Jack Christensen dd160540c4 Use Go 1.13 errors instead of xerrors 2021-03-25 09:08:27 -04:00
Bekmamat d7f92427ad fixed marshaling and unmarshaling 2020-09-22 08:18:39 -05:00
bakmataliev d540ca39be New marshalers have been added 2020-09-11 16:24:48 +03:00
James Lawrence 5576567c19 support unformatted uuid hex string.
adds the abiility to support uuids in the form:
000102030405060708090a0b0c0d0e0f
2020-07-06 11:27:15 -04:00
megaturbo 3105c6e706 Add support for nullable types in Value.Get implementations 2020-06-17 17:04:43 +02: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 a8802b16cc 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 bcc139a365 Port fc020c24ac from pgx v3
commit fc020c24ac
Author: Nicholas Wilson <nicholas.wilson@realvnc.com>
Date:   Wed Jul 24 12:32:18 2019 +0100

    Add support for pgtype.UUID to write into any [16]byte type
2019-08-17 13:30:41 -05:00
Jack Christensen f25878662d Use golang.org/x/xerrors 2019-04-20 17:43:44 -05:00
maxarchx f9440700e5 Apply UUID string length check before parsing 2018-11-30 15:13:43 +05:00
Kelsey Francis 2dfcf74f62 Add UUIDArray type
Also change UUID.Set() to convert nil to NULL in order for
UUIDArray.Set() to support converting [][]byte slices that contain nil.
2017-08-27 19:36:53 -07:00
Jack Christensen a5f166bd21 Use github.com/pkg/errors 2017-06-04 21:30:03 -05:00
Jack Christensen 496c5a4dff Use Go casing convention for UUID 2017-06-03 11:54:57 -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 f0e9337d8f Add satori-uuid type
Make pgtype.EncodeValueText public
2017-04-14 16:46:39 -05:00
Jack Christensen d94f8daeb1 Use pointer methods for all struct pgtypes
Now no need to no whether certain interfaces are implemented by struct or
pointer to struct.
2017-04-14 13:08:05 -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 8cbf667b8e Add pgtype.Uuid 2017-04-04 20:24:01 -05:00