172 Commits

Author SHA1 Message Date
Jack Christensen
989a4835de Remove rune to text conversion
Because rune is an alias for int32 this caused some very surprising
results. e.g. inserting int32(65) into text would insert "A" instead of
"65".
2022-05-12 17:13:49 -05:00
Jack Christensen
01190e5d78 Update ScanPlan.Scan documentation 2022-04-30 08:29:51 -05:00
Jack Christensen
0c6266ef30 Fix scanning null did not overwrite slice 2022-04-26 14:52:01 -05:00
Jack Christensen
7427820aba Scan binary UUID to string
https://github.com/jackc/pgx/issues/1191
2022-04-26 08:37:10 -05:00
Jack Christensen
f9857b73d9 Skip multirange tests on PG < 14 2022-04-23 16:55:24 -05:00
Jack Christensen
dfb681d716 Build / rewrite / port multirange support 2022-04-23 12:50:18 -05:00
Jack Christensen
126b582f19 Make range helpers private 2022-04-23 11:10:04 -05:00
Jack Christensen
cb45e85954 Merge remote-tracking branch 'pgtype/master' into v5-dev 2022-04-23 11:00:07 -05:00
Jack Christensen
468b793282 Skip tests with unsupported types on CockroachDB 2022-04-23 10:34:53 -05:00
Jack Christensen
cc7de81d3b Make array helpers private 2022-04-16 14:21:40 -05:00
Jack Christensen
a01a9ee6df Automatically register Array and FlatArray 2022-04-16 14:04:25 -05:00
Jack Christensen
fccaebc93d Add pgtype.Map.SQLScanner
This enables compatibility with database/sql for types that cannot
implement Scan themselves.
2022-04-16 13:38:27 -05:00
Jack Christensen
f1a4ae3070 Add Array and FlatArray container types 2022-04-16 11:33:45 -05:00
Jack Christensen
d4abe83edb Revert use generics for RangeCodec
Reverted almost all of 976b1e0.

Still may consider a way to get DecodeValue to be strongly typed but
that feature isn't worth the complications of generics. Especially in
that applying this style to ArrayCodec would make Conn.LoadType
impossible for arrays.
2022-04-16 10:39:12 -05:00
Jack Christensen
976b1e03a9 Use generics for RangeCodec
This allows DecodeValue to return a more strongly typed value.
2022-04-09 10:21:17 -05:00
Jack Christensen
c8025fd79a Use generics for Range values 2022-04-09 09:34:37 -05:00
Jack Christensen
f14fb3d692 Replace interface{} with any 2022-04-09 09:12:55 -05:00
Jack Christensen
829babcea9 Better number to string handling
Avoid ambiguity of stringWrapper implementing Int64Scanner and
Float64Scanner.
2022-04-09 09:09:46 -05:00
Jack Christensen
8cf6721d66 Better int64 / numeric compat and text fixes 2022-04-02 16:55:05 -05:00
Jack Christensen
53ec52aa17 Fix out of date pgtype/int_test.go.erb 2022-04-02 14:41:33 -05:00
Jack Christensen
ee93440ac1 pgtype uses pgxtest
Added ValueRoundTripTest to pgxtest
Removed pgtype/testutil

pgtype tests now run with all (applicable) query modes. This gives
better coverage than before and revealed several bugs which are also
fixed in this commit.
2022-04-02 14:34:19 -05:00
Jack Christensen
e392908c72 Remove Int64Valuer implementation from stringWrapper 2022-04-02 08:24:55 -05:00
Jack Christensen
500c0721d7 Improve error messages for query argument encoding 2022-04-01 18:00:25 -05:00
Jack Christensen
3a6d9490e5 Only test numeric infinity on PG 14+ 2022-03-26 11:38:31 -05:00
Jack Christensen
600c4fd931 Skip test for Cockroach CI 2022-03-22 20:44:17 -05:00
Jack Christensen
103dfe145e Test should always close rows 2022-03-22 20:41:05 -05:00
Jack Christensen
e04b35bfcb Make pgtype test compat with CockroachDB when possible 2022-03-22 20:33:24 -05:00
Jack Christensen
be5a6cc9c0 Remove obsolete test 2022-03-22 20:33:24 -05:00
Jack Christensen
5ca048ed2d Fix crash with pointer to nil struct 2022-03-22 20:33:24 -05:00
Jack Christensen
8c18d7808b Add documentation 2022-03-19 17:01:12 -05:00
Jack Christensen
0c166c7620 Fix BC dates in text format 2022-03-12 12:47:01 -06:00
Jack Christensen
c4b08378f2 Handle driver.Valuers inside Map.Encode 2022-03-05 21:27:17 -06:00
Jack Christensen
0905d1f452 Register more default types and handle unknown types better 2022-03-05 21:19:58 -06:00
Jack Christensen
e5685a34fc Simplify encoding extended query arguments 2022-03-05 20:16:57 -06:00
Jack Christensen
1cef9075d9 Simply typed nil and driver.Valuer handling
* Convert typed nils to untyped nils at beginning of encoding process.
* Restore v4 json/jsonb null behavior
* Add anynil internal package
2022-03-05 19:53:59 -06:00
Jack Christensen
2885b039d5 Rename Uint32 field to include bit size
i.e. Uint renamed to Uint32. This matches the pattern set by the
database/sql types.
2022-03-05 09:23:25 -06:00
Jack Christensen
84a3d91322 pgtype Float4 and Float8 fields include bit size
e.g. Instead of Float it is Float64. This matches the pattern set by the
database/sql types.
2022-03-05 09:20:03 -06:00
Jack Christensen
d723a4ab6f pgtype Int2, Int4, and Int8 fields include bit size
e.g. Instead of Int it is Int64. This matches the pattern set by the
database/sql types.
2022-03-05 09:17:31 -06:00
Jack Christensen
872a7a9315 Fix pgtype/int.go.erb 2022-03-05 09:08:14 -06:00
Jack Christensen
e7f90ba6e4 Remove unused pgtype.Map field 2022-03-05 09:00:49 -06:00
Jack Christensen
ec8f7c4204 Add comment for FormatCodeForOID 2022-03-05 08:56:41 -06:00
Jack Christensen
45a8b00271 Do not recursively call public PlanScan that caches
Otherwise, wrapper types get cached. Wrapper types are expected to fail
most of the time. These failures should not be cached. In addition,
wrappers wrap multiple different types so it doesn't make sense to cache
results of a wrapper.
2022-03-04 11:04:46 -06:00
Jack Christensen
a8f6674a07 TextCodec specifically supports scanning to BytesScanner
This lets it support DriverBytes and PreallocatedBytes.
2022-02-26 20:28:15 -06:00
Jack Christensen
ffc5a692cb Detect unsafe pgtype.DriverBytes usage
Add test for unsafe usage and test for correct usage that ensures driver
memory is actually used.
2022-02-26 20:23:35 -06:00
Jack Christensen
d13f651810 Finish importing pgio as internal package 2022-02-21 14:35:20 -06:00
Jack Christensen
43083cb0e3 Memoize pgtype.Map.PlanScan 2022-02-21 10:10:16 -06:00
Jack Christensen
9c538cd4a9 Remove actualTarget argument 2022-02-21 09:30:01 -06:00
Jack Christensen
f3defbc150 Rename pgtype.None to pgtype.Finite 2022-02-21 09:25:30 -06:00
Jack Christensen
1f2f239d09 Renamed pgtype.ConnInfo to pgtype.Map 2022-02-21 09:13:09 -06:00
Jack Christensen
bda10b2ec9 Rename pgtype.DataType to pgtype.Type 2022-02-21 09:01:48 -06:00