Skip to content

Commit 4d8228f

Browse files
authored
fix: sync queryRaw possible result types with query engine (prisma#24872)
1 parent ef53f5c commit 4d8228f

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

packages/client/src/__tests__/deserializeRawResults.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ describe('deserializeRawResult', () => {
149149
'datetime-array',
150150
'date-array',
151151
'time-array',
152-
'unknown-array',
152+
'unknown',
153153
],
154154
rows: [
155155
[

packages/client/src/runtime/utils/deserializeRawResults.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import Decimal from 'decimal.js'
22

3+
// This must remain in sync with the `quaint::ColumnType` enum in the QueryEngine.
4+
// ./quaint/src/connector/column_type.rs
35
type PrismaType =
46
| 'int'
57
| 'bigint'
@@ -22,7 +24,6 @@ type PrismaType =
2224
| 'float-array'
2325
| 'double-array'
2426
| 'string-array'
25-
| 'enum-array'
2627
| 'bytes-array'
2728
| 'bool-array'
2829
| 'char-array'
@@ -33,7 +34,13 @@ type PrismaType =
3334
| 'datetime-array'
3435
| 'date-array'
3536
| 'time-array'
36-
| 'unknown-array'
37+
| 'unknown'
38+
39+
export type RawResponse = {
40+
columns: string[]
41+
types: PrismaType[]
42+
rows: unknown[][]
43+
}
3744

3845
function deserializeValue(type: PrismaType, value: unknown): unknown {
3946
if (value === null) {
@@ -75,12 +82,6 @@ function deserializeValue(type: PrismaType, value: unknown): unknown {
7582
}
7683
}
7784

78-
export type RawResponse = {
79-
columns: string[]
80-
types: PrismaType[]
81-
rows: unknown[][]
82-
}
83-
8485
type DeserializedResponse = Array<Record<string, unknown>>
8586

8687
export function deserializeRawResult(response: RawResponse): DeserializedResponse {

0 commit comments

Comments
 (0)