Commit Graph

16 Commits (5db1de5fc18703ddf645024dff9ff73c98bc9107)

Author SHA1 Message Date
Jack Christensen c16a4f7d6a Revert "Temporarily delete tests and pgxtype to break recursive dependency with pgx"
This reverts commit 32e20a6031.
2021-07-24 10:40:30 -05:00
Jack Christensen 32e20a6031 Temporarily delete tests and pgxtype to break recursive dependency with pgx 2021-07-24 10:16:00 -05:00
Jack Christensen 0bbaad1348 Add zeronull package for easier NULL <-> zero conversion 2020-01-24 11:23:28 -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 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 a0f487bc09 More transcoding type tests
Text every combination of text and binary arguments and text and binary
results.
2019-04-13 14:17:04 -05:00
Jack Christensen 7fbae064bb Remove simple protocol and one round trip query options
It is impossible to guarantee that the a query executed with the simple
protocol will behave the same as with the extended protocol. This is
because the normal pgx path relies on knowing the OID of query
parameters. Without this encoding a value can only be determined by the
value instead of the combination of value and PostgreSQL type. For
example, how should a []int32 be encoded? It might be encoded into a
PostgreSQL int4[] or json.

Removal also simplifies the core query path.

The primary reason for the simple protocol is for servers like PgBouncer
that may not be able to support normal prepared statements. After
further research it appears that issuing a "flush" instead "sync" after
preparing the unnamed statement would allow PgBouncer to work.

The one round trip mode can be better handled with prepared statements.

As a last resort, all original server functionality can still be accessed by
dropping down to PgConn.
2019-04-13 11:39:01 -05:00
Jack Christensen 59003afe8c Fix encode empty value 2019-04-12 21:23:57 -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 6b906ca870 Refactor pgio and types to append buffers 2017-05-02 20:38:26 -05:00
Jack Christensen fa68e44e5f Use pgx.ParseConnectionString in test helper
This allows using URI or DSN for database connection information. DSN allows
using unix domain sockets.
2017-04-14 17:21:32 -05:00
Jack Christensen 851479b0d3 Replace DATABASE_URL with PGX_TEST_DATABASE
PGX_TEST_DATABASE is much less likely to collide with another environment
variable. This is especially valuable when using direnv to automatically set
environment variables.
2017-04-14 17:11:39 -05:00
Jack Christensen e380de7cd1 Finish extraction of pgtype test helpers 2017-04-14 12:38:33 -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