326 Commits

Author SHA1 Message Date
Jack Christensen
740b3a5115 Fix: Text array parsing disambiguates NULL and "NULL".
This solution is a little awkward, but it avoids breaking backwards
compatibility.

fixes #78
2020-11-07 07:41:49 -06:00
Jack Christensen
36a8da55cc Fix Timestamptz.DecodeText with too short text
fixes #74
2020-11-03 08:31:05 -06:00
Jack Christensen
af0ca3a39b Fix simple protocol empty array and original recursive empty array issue
Original issue https://github.com/jackc/pgtype/issues/68

This crash occurred in the recursive assignment system used to support
multidimensional arrays.

This was fixed in 9639a69d451f55456f598c1aa8b93053f8df3088. However,
that fix incorrectly used nil instead of an empty slice.

In hindsight, it appears the fundamental error is that an assignment to
a slice of a type that is not specified is handled with the recursive /
reflection path. Or another way of looking at it is as an unexpected
feature where []T can now be scanned if individual elements are
assignable to T even if []T is not specifically handled.

But this new reflection / recursive path did not handle empty arrays.

This fix handles the reflection path for an empty slice by allocating an
empty slice.
2020-10-31 17:12:16 -05:00
Jack Christensen
9d7fc8e63a AssignTo pointer to pointer to slice and named types
fixes #69
2020-10-24 09:21:42 -05:00
Simo Haasanen
9639a69d45 Adds checks for zero length arrays.
Assigning values from nil or zero length elements or dimensions now return immediately as there are no values to assign.
2020-10-20 19:52:05 +01:00
Tomas Volf
e92478ec70
Fix Inet.Set to handle nil net.IP correctly
When nil IP is returned from net.ParseIP, it is accepted into Inet type,
but not properly marked as being Null. That introduces issues later on
when calling for example EncodeBinary, since it does not assume this can
happen.

This commit resolves that by properly detecting zero-length net.IP and
setting status to Null if that is the case.
2020-10-13 15:26:09 +02:00
duohedron
2bc8c67e4a Fix misleading names parseString and parseFloat64 in polygon.go 2020-10-08 07:59:44 -05:00
duohedron
b55f972f49 Add comment to Polygon.Set() 2020-10-08 07:59:44 -05:00
duohedron
8aa7211df5 Add tests to Polygon 2020-10-08 07:59:44 -05:00
duohedron
6166c99b77 Add Undefined status to invalid Polygon 2020-10-08 07:59:44 -05:00
duohedron
e09987f1d6 Add tests to Polygon 2020-10-08 07:59:44 -05:00
duohedron
2dca42ee7d Add Set(string|[]Vec2|[]float64) to Polygon 2020-10-08 07:59:44 -05:00
Erik Agsjö
66c36ff24f Support setting infinite timestamps 2020-10-08 07:58:57 -05:00
Jack Christensen
376361f53d Add tests for Int(2|4|8).Set accepting float(32|64) 2020-10-03 08:36:40 -05:00
lqu3j
909d814f65 support float64, float32 convert to int2, int4, int8 2020-09-29 13:10:38 +08:00
Jack Christensen
116eba4401 Release v1.5.0 2020-09-26 11:48:37 -05:00
Bekmamat
d7f92427ad fixed marshaling and unmarshaling 2020-09-22 08:18:39 -05:00
Jack Christensen
fbe354aea1 Remove editor specific .gitignore 2020-09-15 17:21:13 -05:00
bakmataliev
6777e0294b eliminate regex dep 2020-09-15 13:24:17 +03:00
bakmataliev
cd9b888ff6 Remove unnecessary check for null 2020-09-11 16:28:49 +03:00
bakmataliev
d540ca39be New marshalers have been added 2020-09-11 16:24:48 +03:00
Jack Christensen
e7d2b057a7 Text formatted values except bytea can be directly scanned to []byte
This significantly improves performance of scanning text to []byte as it
avoids multiple allocations and copies.
2020-09-05 11:13:53 -05:00
Jack Christensen
9da6afcad7 Fix selecting empty array
Failing test was in pgx: TestReadingValueAfterEmptyArray
2020-09-05 10:56:22 -05:00
Jack Christensen
79b05217d1 Fix JSONBArray to have elements of JSONB 2020-09-04 18:41:34 -05:00
Simo Haasanen
ec14212d30 Add comments to explain the use of reflection after type assertion.
Removes one local variable, which is used twice only in an error.
2020-08-09 09:17:40 +01:00
Simo Haasanen
b90570feb5 Restored more optimised array type conversions for a few select 1D-slice types.
Results of calls to the reflect lib are now stored as local variables for small performance gains.
2020-08-08 19:51:37 +01:00
Simo Haasanen
449a8a4f8e Add multidimensional array and slice support.
Adds array support - previously only slices were supported.
Adds new test cases for multidimensional arrays and slices.
All previous test cases are unmodified and passed (fully backwards compatible).
Removes hard-coded type conversions for arrays, instead now relies on the type support of the array element's type conversion support.
Less maintenance for arrays, new type conversions are automatically supported when array's element gains new type support.
Simplifies typed_array_gen.sh generator script by removing the hard-coded single-dimensional types for arrays.
Only typed_array.go.erb and typed_array_gen.sh have been changed + 1 new auxiliary function in array.go file + additional tests in test files for each array. Other changes are from generated code.
2020-08-07 13:10:32 +01:00
Jack Christensen
d831ba712a Release v1.4.2 2020-07-22 06:46:27 -05:00
Jack Christensen
7673c8578d Update changelog 2020-07-22 06:45:10 -05:00
Yaz Saito
b939bc8d68 Fix encoding of a large composite data type
If encoding a field caused a buffer reallocation, the its length would be
written to a wrong place.
2020-07-21 23:52:20 -07:00
Jack Christensen
7a3e774a52 Fix ArrayType DecodeBinary empty array breaks future reads 2020-07-14 11:58:10 -05:00
Jack Christensen
aa245bcc44
Merge pull request #47 from bakape/fix/struct-padding
optimise struct padding
2020-07-13 07:38:09 -05:00
bakape
193ecfec73
optimise struct padding 2020-07-12 13:52:32 +03:00
James Lawrence
5576567c19 support unformatted uuid hex string.
adds the abiility to support uuids in the form:
000102030405060708090a0b0c0d0e0f
2020-07-06 11:27:15 -04:00
Jack Christensen
efe4704c57 Release v1.4.0 2020-06-27 12:25:17 -05:00
Jack Christensen
c4e2b4bda3 Update changelog 2020-06-27 12:24:46 -05:00
Jack Christensen
66a0b33655 Rerun typed_array_gen.sh 2020-06-24 08:40:34 -05:00
Andrei Tserakhau
4f940b06eb
Merge branch 'master' into fix-490 2020-06-21 14:23:49 +03:00
tserakhau
44f45c6c62 Use erb for jsonb array generation 2020-06-21 14:21:16 +03:00
Jack Christensen
41a185b611 Allow converting intervals with months and days to duration
It's a lossy conversion but so is numeric to float.

fixes #42
2020-06-20 13:26:06 -05:00
Jack Christensen
3d6abc3c5b
Merge pull request #41 from TrueLevelSA/feat/slice-of-pointers
Create pgtypes (and slices of) from pointers
2020-06-20 13:14:43 -05:00
tserakhau
35d2873de1 Fix 490: Add jsonb arrays for pgx v4 2020-06-18 17:11:54 +03:00
megaturbo
bc07106f0e Add Code generated notice at the top of the file 2020-06-17 17:04:43 +02:00
megaturbo
066bc77610 Add support for slice of nullable types in array types 2020-06-17 17:04:43 +02:00
megaturbo
3105c6e706 Add support for nullable types in Value.Get implementations 2020-06-17 17:04:43 +02:00
Jack Christensen
09efc38390 Update changelog 2020-06-11 21:36:50 -05:00
Jack Christensen
a0bff84d73 Merge branch 'leighhopcroft-numeric-nan-support' 2020-06-11 21:35:49 -05:00
Jack Christensen
7bcd9fbdaf Rename IsNaN to NaN 2020-06-11 21:35:32 -05:00
Jack Christensen
ee66a98ace Merge branch 'numeric-nan-support' of git://github.com/leighhopcroft/pgtype into leighhopcroft-numeric-nan-support 2020-06-11 21:29:49 -05:00
Jack Christensen
43696815c2
Merge pull request #39 from powersjcb/add-travis-config
Duplicate travis config from pgx
2020-06-11 19:45:24 -05:00