@prisma-next/sql-orm-client 0.5.1 → 0.6.0-dev.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +10 -10
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +43 -77
- package/dist/index.mjs.map +1 -1
- package/package.json +17 -17
- package/src/collection-internal-types.ts +8 -7
- package/src/model-accessor.ts +10 -3
- package/src/query-plan-aggregate.ts +17 -12
- package/src/query-plan-mutations.ts +18 -14
- package/src/query-plan-select.ts +7 -4
- package/src/types.ts +246 -287
- package/src/where-binding.ts +5 -8
package/src/where-binding.ts
CHANGED
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
ProjectionItem,
|
|
21
21
|
SelectAst,
|
|
22
22
|
} from '@prisma-next/sql-relational-core/ast';
|
|
23
|
+
import { codecRefForStorageColumn } from '@prisma-next/sql-relational-core/codec-descriptor-registry';
|
|
23
24
|
|
|
24
25
|
export function bindWhereExpr(contract: Contract<SqlStorage>, expr: AnyExpression): AnyExpression {
|
|
25
26
|
return bindWhereExprNode(contract, expr);
|
|
@@ -118,14 +119,11 @@ function createParamRef(
|
|
|
118
119
|
columnRef: ColumnRef,
|
|
119
120
|
value: unknown,
|
|
120
121
|
): ParamRef {
|
|
121
|
-
|
|
122
|
-
if (!codecId) {
|
|
122
|
+
if (!contract.storage.tables[columnRef.table]?.columns[columnRef.column]) {
|
|
123
123
|
throw new Error(`Unknown column "${columnRef.column}" in table "${columnRef.table}"`);
|
|
124
124
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
refs: { table: columnRef.table, column: columnRef.column },
|
|
128
|
-
});
|
|
125
|
+
const codec = codecRefForStorageColumn(contract.storage, columnRef.table, columnRef.column);
|
|
126
|
+
return ParamRef.of(value, codec ? { codec } : undefined);
|
|
129
127
|
}
|
|
130
128
|
|
|
131
129
|
function createExpressionBinder(contract: Contract<SqlStorage>): ExpressionRewriter {
|
|
@@ -176,8 +174,7 @@ function bindSelectAst(contract: Contract<SqlStorage>, ast: SelectAst): SelectAs
|
|
|
176
174
|
new ProjectionItem(
|
|
177
175
|
projection.alias,
|
|
178
176
|
bindProjectionExpr(contract, projection.expr),
|
|
179
|
-
projection.
|
|
180
|
-
projection.refs,
|
|
177
|
+
projection.codec,
|
|
181
178
|
),
|
|
182
179
|
),
|
|
183
180
|
where: ast.where ? bindWhereExprNode(contract, ast.where) : undefined,
|