Commit Graph

36 Commits (4c6f1b1dc49de587531c756b1120fc877c739cee)

Author SHA1 Message Date
Jens Emil Schulz Østergaard 4c6f1b1dc4 fix: add json rawmessage to typed_array_gen.sh 2022-03-21 19:15:21 -05:00
Vasilii Novikov 1e141d8c32 Add tsrange array type. 2021-01-09 09:40:43 -06:00
Jack Christensen 79b05217d1 Fix JSONBArray to have elements of JSONB 2020-09-04 18:41:34 -05: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
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
megaturbo 066bc77610 Add support for slice of nullable types in array types 2020-06-17 17:04:43 +02:00
Jack Christensen 038f263a44 Add remaining int array conversions 2019-11-27 20:23:43 -06:00
Jean-Philippe Quéméner 01ae643a48 feat: make conversion between numeric values and arrays less strict
closes https://github.com/jackc/pgx/issues/642
2019-11-26 17:11:54 +01:00
Jack Christensen be36a7e14b Fix test and avoid change to array signatures
typed_array.go.erb was not updated back in
a8802b16cc when Value, EncodeBinary,
EncodeText, and MarshalJSON were changed to be defined on T instead of
*T. This has been corrected.
2019-11-14 20:40:41 -06:00
Andrew Huang f517670ba5 Add tstzrange data type 2019-09-18 15:01:37 -07:00
Jack Christensen ea65a92de9 Fix long standing text array text format null bug 2019-04-13 14:06:01 -05:00
Anthony Regeda 88d317af97 macaddr-array macaddr array is introduced 2018-09-01 16:06:20 +03:00
Anthony Regeda 5524d654d3 numeric_with_uint64 numeric array supports both types int64 and uint64 2018-04-24 16:31:31 +03:00
Iurii Krasnoshchok 91bb74b526 Add support for bpchar type 2018-01-02 12:29:40 +01:00
Jack Christensen 5ba28cf2c5 Add support for array of enum
fixes #338
2017-10-17 20:31:11 -05:00
Jack Christensen 703ce85513 Generate UUIDArray from template
- Fix error in Set
- Specifically handle untyped nil
2017-08-29 14:33:25 -05:00
Jack Christensen 654adbdd4a Use Go casing convention for CID/TID/XID/CIDR 2017-06-03 12:01:49 -05:00
Jack Christensen 01fa5960b2 Use Go casing convention for ACLItem 2017-06-03 11:58:40 -05:00
Jack Christensen cc873a0bcf Add pgtype.NumericArray 2017-04-03 07:46:45 -05:00
Jack Christensen 4645475800 Run goimports as part of array gen script 2017-03-20 08:00:43 -05:00
Jack Christensen 3acd3d8546 Optionally generate binary array format 2017-03-18 17:38:58 -05:00
Jack Christensen df8f8e17cf Add pgtype.HstoreArray
This required restructuring array types to lookup oid of element instead of
hard-coding it due to hstore having a variable oid.
2017-03-18 12:40:54 -05:00
Jack Christensen 6e21cb00fe 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 666af9ead5 Name PG types as words
Though this doesn't follow Go naming conventions exactly it makes names more
consistent with PostgreSQL and it is easier to read. For example, TIDOID becomes
TidOid. In addition this is one less breaking change in the move to V3.
2017-03-11 17:03:23 -06:00
Jack Christensen 44e206ab5b Rename array files 2017-03-11 16:53:07 -06:00
Jack Christensen 2f63514c47 Move ACLItem to pgtype 2017-03-11 16:13:05 -06:00
Jack Christensen 86620c5e91 Add pgtype.ByteaArray
Also fix up quoting array elements for text arrays.
2017-03-11 13:32:32 -06:00
Jack Christensen e654d1f0fc pgtype.Encode(Binary|Text) do not write length
To aid in composability, these methods no longer write their own length. This
is especially useful for text formatted arrays and may be useful for future
database/sql compatibility. It also makes the code a little simpler as the
types no longer have to compute their own size.

Along with this, these methods cannot encode NULL. They now return a boolean
if they are NULL. This also benefits text array encoding as numeric arrays
require NULL to be exactly `NULL` while string arrays require NULL to be
`"NULL"`.
2017-03-11 12:45:30 -06:00
Jack Christensen bb7122d4a8 Fix typed_array_gen.sh typo 2017-03-09 21:09:36 -06:00
Jack Christensen 4254e5f2d2 Add text to pgtype 2017-03-04 21:20:56 -06:00
Jack Christensen 93e1715082 Add inet and cidr to pgtype 2017-03-04 17:33:41 -06:00
Jack Christensen 0f115477de Add float4, float8 and arrays 2017-03-04 13:29:04 -06:00
Jack Christensen 39b60605ae Add timestamp to pgtype 2017-03-04 12:36:24 -06:00
Jack Christensen 34c5070371 Add arrays to all other pgtypes 2017-03-04 11:48:53 -06:00