Skip to content

Commit a89e8aa

Browse files
committed
chore: address comment
1 parent 8ce6694 commit a89e8aa

2 files changed

Lines changed: 4 additions & 5 deletions

File tree

packages/adapter-ppg/src/conversion.test.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,13 +152,12 @@ describe('conversion', () => {
152152
})
153153

154154
test('supports arrays of bytea', () => {
155-
const result = getParser(ArrayColumnType.BYTEA_ARRAY)('{aGVsbG8=,d29ybGQ=}')
155+
const result = getParser(ArrayColumnType.BYTEA_ARRAY)('{aGVsbG8=,NULL}')
156156
expect(Array.isArray(result)).toBe(true)
157157
expect(result!.length).toBe(2)
158158
expect(Buffer.isBuffer(result![0])).toBe(true)
159-
expect(Buffer.isBuffer(result![1])).toBe(true)
160159
expect(result![0]!.toString()).toBe('aGVsbG8=')
161-
expect(result![1]!.toString()).toBe('d29ybGQ=')
160+
expect(result![1]).toBeNull()
162161
})
163162
})
164163
})

packages/adapter-ppg/src/conversion.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -414,9 +414,9 @@ const builtInByteParser = getTypeParser(ScalarColumnType.BYTEA) as (_: string) =
414414
/*
415415
* BYTEA_ARRAY - arrays of arbitrary raw binary strings
416416
*/
417-
function normalizeByteaArray(x: string | null): Buffer[] | null {
417+
function normalizeByteaArray(x: string | null): (Buffer | null)[] | null {
418418
if (x === null) return null
419-
return parseArray(x).map(builtInByteParser)
419+
return parseArray(x).map((elem) => (elem === null ? null : builtInByteParser(elem)))
420420
}
421421

422422
function convertBytes(serializedBytes: string | null): Buffer | null {

0 commit comments

Comments
 (0)