11 Commits

Author SHA1 Message Date
Jack Christensen
f6d37536c4 Detect erroneous JSON(B) encoding
JSON(B) automatically marshals any value. Avoid marshalling values of
pgtype.JSON and pgtype.JSONB. The caller certainly meant to call on a
pointer.

See https://github.com/jackc/pgx/issues/350 for discussion.

refs #350
2017-11-04 19:09:24 -05:00
Jack Christensen
8f4178b3d3 Use github.com/pkg/errors 2017-06-04 21:30:03 -05:00
Jack Christensen
6688466123 Use Go casing convention for JSON(B) 2017-06-03 11:57:14 -05:00
Jack Christensen
6e64a0c867 Refactor pgio and types to append buffers 2017-05-02 20:38:26 -05:00
Jack Christensen
932caef600 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
a8c350c77d 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
7b1f461ec3 Add simple protocol suuport with (Query|Exec)Ex 2017-04-10 08:58:51 -05:00
Jack Christensen
bec9bd261b Add database/sql support to pgtype 2017-03-18 21:11:43 -05:00
Jack Christensen
19c6689752 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
Jack Christensen
57494a6a0f Expand pgtype.Value interface
- Include and rename ConvertFrom to Set
- Add Get
- Include AssignTo
2017-03-11 19:53:45 -06:00
Jack Christensen
542eac08c6 Add json/jsonb to pgtype 2017-03-11 18:46:51 -06:00