13 Commits

Author SHA1 Message Date
Maxim Ivanov
ff95f82f70 Add ScanRowValue helper function
ScanRowValue is useful when reading ROW() values with
known field types as well as composite types. It accepts
pgtype.Value arguments, where ROW() fields are written to
on successfull scan.
2020-04-12 12:26:12 +01:00
Maxim Ivanov
9a869c8359 Refactor record field binary decoder preparation 2020-04-11 11:08:53 +01: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
4ed0de4755 Splitting pgtype into own repo 2019-04-20 19:14:08 -05:00
Jack Christensen
8502a12ac7 Fix go modules
Wow. This is fun. Sure is easy to get modules wrong when upgrading a v2+
project.
2019-04-20 17:41:08 -05:00
Jack Christensen
6161728ff9 Prepare takes context
Also remove PrepareEx. It's primary usage was for context. Supplying
parameter OIDs is unnecessary when you can type cast in the query SQL.
If it does become necessary or desirable to add options back it can be
added in a backwards compatible way by adding a varargs as last
argument.
2019-04-20 11:47:16 -05:00
Jack Christensen
fcbd9e93fa Initial pass at fixing pgtype tests
Many still failing, but at least it compiles now.
2019-04-12 16:58:42 -05:00
Jack Christensen
81b3e79897 Merge pull request #371 from ferhatelmas/gofmt-simplify
Run gofmt with simplify flag
2017-12-23 10:32:44 -06:00
Jack Christensen
5bd04dc568 Add test for record with unknown OID 2017-12-23 10:24:09 -06:00
ferhat elmas
645e646183 Run gofmt with simplify flag 2017-12-21 23:45:26 +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
e380de7cd1 Finish extraction of pgtype test helpers 2017-04-14 12:38:33 -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