Commit Graph

21 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
Jack Christensen fcb385dccb Add ScanDecoder and ScanValue to composite scanners.
Rename Scan to Next to disambiguate.
2020-05-12 15:04:14 -05:00
Jack Christensen 452511dfc5 Rename RecordFieldIter to CompositeBinaryScanner and adjust interface
Use interface similar to bufio.Scanner and pgx.Rows.
2020-05-07 13:38:19 -05:00
Jack Christensen ff9bc5d68d Merge binary package into pgtype package 2020-05-07 10:15:23 -05:00
Maxim Ivanov 2e13f2fe76 Move lowlevel binary routines into own package 2020-04-16 21:34:06 +01:00
Maxim Ivanov 9a869c8359 Refactor record field binary decoder preparation 2020-04-11 11:08:53 +01:00
Maxim Ivanov 087df120bb Refactor lowlevel record field iteration 2020-04-11 10:38:23 +01: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 ab885b375b OID type should only be used for scanning and encoding values
It was a mistake to use it in other contexts. This made interop
difficult between pacakges that depended on pgtype such as pgx and
packages that did not like pgconn and pgproto3. In particular this was
awkward for prepared statements.

Because pgx depends on pgtype and the tests for pgtype depend on pgx
this change will require a couple back and forth commits to get the
go.mod dependecies correct.
2019-08-24 13:49:12 -05:00
Jack Christensen f25878662d Use golang.org/x/xerrors 2019-04-20 17:43:44 -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
Damir Vandic 79ba0275de Add the type of the value in all decode error messages 2018-06-04 21:02:20 +02:00
Iurii Krasnoshchok e22e7e67ec Return error on unknown oid while decoding record instead of panic 2017-12-20 14:47:52 +01:00
Jack Christensen 2e630dddf9 Fix decoding row with same type values
Row decoding was reusing and returning connection owned values for
decoding. Instead allocate new value each time.

fixes #313
2017-08-29 15:38:45 -05:00
Jack Christensen a5f166bd21 Use github.com/pkg/errors 2017-06-04 21:30:03 -05:00
Jack Christensen 2140814606 Use Go casing convention for OID 2017-06-03 11:53:49 -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 6f9ef694d0 Add database/sql support to pgtype 2017-03-18 21:11:43 -05:00
Jack Christensen 85f7df1e81 Factor out duplication in AssignTo 2017-03-18 16:54:08 -05:00
Jack Christensen 6e21cb00fe Add pgtype.Record and prerequisite restructuring
Because reading a record type requires the decoder to be able to look up oid
to type mapping and types such as hstore have types that are not fixed between
different PostgreSQL servers it was necessary to restructure the pgtype system
so all encoders and decodes take a *ConnInfo that includes oid/name/type
information.
2017-03-18 12:01:16 -05:00