Skip to content

Commit a857a34

Browse files
committed
Add support for INT2 and INT8 (bigint) arrays
1 parent 5bfe184 commit a857a34

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

CHANGES.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
In next release ...
22

3+
- Add support for the INT2 and INT8 array types.
4+
35
- The `Connect` and `End` events have been removed, in addition to the `Parameter`
46
event; the `connect` method now returns an object with information about the
57
established connection, namely whether the connection is encrypted and the

src/types.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,13 @@ export enum DataType {
3939
Inet = 869,
4040
ArrayBytea = 1001,
4141
ArrayChar = 1002,
42+
ArrayInt2 = 1005,
4243
ArrayInt4 = 1007,
4344
ArrayRegprocedure = 1008,
4445
ArrayText = 1009,
4546
ArrayBpchar = 1014,
4647
ArrayVarchar = 1015,
48+
ArrayInt8 = 1016,
4749
ArrayFloat4 = 1021,
4850
ArrayFloat8 = 1022,
4951
Aclitem = 1033,
@@ -108,7 +110,9 @@ export const arrayDataTypeMapping: ReadonlyMap<DataType, DataType> = new Map([
108110
[DataType.ArrayDate, DataType.Date],
109111
[DataType.ArrayFloat4, DataType.Float4],
110112
[DataType.ArrayFloat8, DataType.Float8],
113+
[DataType.ArrayInt2, DataType.Int2],
111114
[DataType.ArrayInt4, DataType.Int4],
115+
[DataType.ArrayInt8, DataType.Int8],
112116
[DataType.ArrayJson, DataType.Json],
113117
[DataType.ArrayJsonb, DataType.Jsonb],
114118
[DataType.ArrayText, DataType.Text],

test/types.test.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,10 @@ describe('Types', () => {
189189
'ARRAY[\'123e4567-e89b-12d3-a456-426655440000\'::uuid]',
190190
['123e4567-e89b-12d3-a456-426655440000']
191191
);
192+
testType<number[]>(
193+
DataType.ArrayInt2,
194+
'\'{1,2,3}\'::int2[3]',
195+
[1, 2, 3]);
192196
testType<number[]>(
193197
DataType.ArrayInt4,
194198
'\'{1,2,3}\'::int4[3]',
@@ -201,6 +205,10 @@ describe('Types', () => {
201205
DataType.ArrayInt4,
202206
'\'{{{1, 2}, {3, 4}}, {{5, 6}, {7, 8}}}\'::int4[]',
203207
[[[1, 2], [3, 4]], [[5, 6], [7, 8]]]);
208+
testType<bigint[]>(
209+
DataType.ArrayInt8,
210+
'\'{1,2,3}\'::int8[3]',
211+
[BigInt(1), BigInt(2), BigInt(3)]);
204212
testType<number[]>(
205213
DataType.ArrayFloat4,
206214
'\'{1.0, 2.0, 3.0}\'::float4[3]',

0 commit comments

Comments
 (0)