100 Commits

Author SHA1 Message Date
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
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
500c0721d7 Improve error messages for query argument encoding 2022-04-01 18:00:25 -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
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
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
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
Jack Christensen
a3c351d11a RegisterDataType now accepts *DataType 2022-02-21 08:49:04 -06:00
Jack Christensen
7193e48923 Restore multi-dimensional slices
Move ArrayCode to use pgtype wrapper pattern as well
2022-02-08 10:07:40 -06:00
Jack Christensen
3a94113118 Add composite to arbitrary struct encoding and decoding 2022-02-05 14:24:34 -06:00
Jack Christensen
727fc19cb7 Another error message improvement 2022-02-05 13:10:58 -06:00
Jack Christensen
28ea2cd190 Better error messages 2022-02-05 13:05:23 -06:00
Jack Christensen
ba4583cf4c Add range array types 2022-02-02 08:47:56 -06:00
Jack Christensen
cebe44ee85 Restore range support 2022-02-02 08:40:42 -06:00
Jack Christensen
11223497b3 Restore record support 2022-01-31 20:42:12 -06:00
Jack Christensen
558748ef9c ArrayCodec contains element DataType 2022-01-29 16:41:07 -06:00
Jack Christensen
0ddf9e3b4b Try wrapping scan target before sql.Scanner
This allows wrappers to directly avoid the slow sql.Scanner interface.
2022-01-22 18:40:46 -06:00
Jack Christensen
5ed95dcd1c Expose wrap functions on ConnInfo
- Remove rarely used ScanPlan.Scan arguments
- Plus other refactorings and fixes that fell out of this change.
- Plus rows Scan now handles checking for changed type.
2022-01-22 17:50:19 -06:00
Jack Christensen
322bfedc60 Remove old SQL scanner integration 2022-01-22 16:20:37 -06:00
Jack Christensen
aedf7d63e5 Expose try wrap functions in ConnInfo 2022-01-22 16:19:32 -06:00
Jack Christensen
2b395f3730 pgtype.DataType.Codec can never be nil 2022-01-22 12:21:16 -06:00
Jack Christensen
db95cee40c Remove pgtype.Value interface 2022-01-22 12:18:40 -06:00
Jack Christensen
4cf6dc9447 Remove BinaryEncoder and TextEncoder 2022-01-22 12:16:02 -06:00
Jack Christensen
3a90c6c879 Removed TextEncoder and BinaryEncoder
Restructured / fixed a lot of tests along the way.
2022-01-22 12:07:35 -06:00
Jack Christensen
eb0a4c9626 Replace some old database/sql compatibility 2022-01-22 11:21:12 -06:00
Jack Christensen
ad785d8134 Remove TypeValue interface 2022-01-22 10:56:56 -06:00
Jack Christensen
740263c0d4 Convert UUID to Codec 2022-01-22 10:53:47 -06:00
Jack Christensen
b9b5e35d0f Convert numeric to Codec 2022-01-22 09:31:59 -06:00
Jack Christensen
0056156904 Add time array 2022-01-21 16:51:53 -06:00
Jack Christensen
61b4fb7689 Convert time to Codec 2022-01-21 16:50:30 -06:00
Jack Christensen
5ca29a014e Add tid array 2022-01-20 20:41:56 -06:00
Jack Christensen
7a3bc454e0 Convert TID to Codec 2022-01-20 20:40:37 -06:00
Jack Christensen
b10eb89fe4 Use wrapper to treat fmt.String as pgtype.TextValuer 2022-01-20 20:22:53 -06:00
Jack Christensen
06f4e47750 Add macaddr array 2022-01-20 20:10:43 -06:00
Jack Christensen
97443487ce Convert macaddr to Codec 2022-01-20 20:07:09 -06:00