effect-qb 0.16.0 → 0.17.0
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/mysql.js +1661 -591
- package/dist/postgres/metadata.js +1930 -135
- package/dist/postgres.js +7808 -6718
- package/dist/sqlite.js +8360 -0
- package/package.json +6 -1
- package/src/internal/derived-table.ts +29 -3
- package/src/internal/dialect.ts +2 -0
- package/src/internal/dsl-mutation-runtime.ts +173 -4
- package/src/internal/dsl-plan-runtime.ts +165 -20
- package/src/internal/dsl-query-runtime.ts +60 -6
- package/src/internal/dsl-transaction-ddl-runtime.ts +72 -2
- package/src/internal/executor.ts +47 -9
- package/src/internal/expression-ast.ts +3 -2
- package/src/internal/grouping-key.ts +141 -1
- package/src/internal/implication-runtime.ts +2 -1
- package/src/internal/json/types.ts +155 -40
- package/src/internal/predicate/context.ts +14 -1
- package/src/internal/predicate/key.ts +19 -2
- package/src/internal/predicate/runtime.ts +27 -3
- package/src/internal/query.ts +252 -30
- package/src/internal/renderer.ts +35 -2
- package/src/internal/runtime/driver-value-mapping.ts +58 -0
- package/src/internal/runtime/normalize.ts +62 -38
- package/src/internal/runtime/schema.ts +5 -3
- package/src/internal/runtime/value.ts +153 -30
- package/src/internal/table-options.ts +108 -1
- package/src/internal/table.ts +87 -29
- package/src/mysql/column.ts +18 -2
- package/src/mysql/datatypes/index.ts +21 -0
- package/src/mysql/errors/catalog.ts +5 -5
- package/src/mysql/errors/normalize.ts +2 -2
- package/src/mysql/internal/dsl.ts +736 -218
- package/src/mysql/internal/renderer.ts +2 -1
- package/src/mysql/internal/sql-expression-renderer.ts +486 -130
- package/src/mysql/query.ts +9 -2
- package/src/mysql/table.ts +38 -12
- package/src/postgres/column.ts +4 -2
- package/src/postgres/errors/normalize.ts +2 -2
- package/src/postgres/executor.ts +48 -5
- package/src/postgres/function/core.ts +19 -1
- package/src/postgres/internal/dsl.ts +683 -240
- package/src/postgres/internal/renderer.ts +2 -1
- package/src/postgres/internal/schema-ddl.ts +2 -1
- package/src/postgres/internal/schema-model.ts +6 -3
- package/src/postgres/internal/sql-expression-renderer.ts +420 -91
- package/src/postgres/json.ts +57 -17
- package/src/postgres/query.ts +9 -2
- package/src/postgres/schema-management.ts +91 -4
- package/src/postgres/schema.ts +1 -1
- package/src/postgres/table.ts +189 -53
- package/src/sqlite/column.ts +128 -0
- package/src/sqlite/datatypes/index.ts +79 -0
- package/src/sqlite/datatypes/spec.ts +98 -0
- package/src/sqlite/errors/catalog.ts +103 -0
- package/src/sqlite/errors/fields.ts +19 -0
- package/src/sqlite/errors/index.ts +19 -0
- package/src/sqlite/errors/normalize.ts +229 -0
- package/src/sqlite/errors/requirements.ts +71 -0
- package/src/sqlite/errors/types.ts +29 -0
- package/src/sqlite/executor.ts +227 -0
- package/src/sqlite/function/aggregate.ts +2 -0
- package/src/sqlite/function/core.ts +2 -0
- package/src/sqlite/function/index.ts +19 -0
- package/src/sqlite/function/string.ts +2 -0
- package/src/sqlite/function/temporal.ts +100 -0
- package/src/sqlite/function/window.ts +2 -0
- package/src/sqlite/internal/dialect.ts +37 -0
- package/src/sqlite/internal/dsl.ts +6926 -0
- package/src/sqlite/internal/renderer.ts +47 -0
- package/src/sqlite/internal/sql-expression-renderer.ts +1821 -0
- package/src/sqlite/json.ts +2 -0
- package/src/sqlite/query.ts +196 -0
- package/src/sqlite/renderer.ts +24 -0
- package/src/sqlite/table.ts +183 -0
- package/src/sqlite.ts +22 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import * as Query from "../../internal/query.js"
|
|
2
|
+
import type * as Expression from "../../internal/scalar.js"
|
|
3
|
+
import { type RenderState } from "../../internal/dialect.js"
|
|
4
|
+
import { sqliteDialect } from "./dialect.js"
|
|
5
|
+
import { type Projection } from "../../internal/projections.js"
|
|
6
|
+
import { renderQueryAst } from "./sql-expression-renderer.js"
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Internal rendered-query payload produced by the built-in SQLite renderer.
|
|
10
|
+
*/
|
|
11
|
+
export interface SqliteRenderResult {
|
|
12
|
+
readonly sql: string
|
|
13
|
+
readonly params: readonly unknown[]
|
|
14
|
+
readonly projections: readonly Projection[]
|
|
15
|
+
readonly valueMappings?: Expression.DriverValueMappings
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface SqliteRenderOptions {
|
|
19
|
+
readonly valueMappings?: Expression.DriverValueMappings
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Renders the current query AST into SQLite-shaped SQL plus bind parameters.
|
|
24
|
+
*/
|
|
25
|
+
export const renderSqlitePlan = <PlanValue extends Query.Plan.Any>(
|
|
26
|
+
plan: Query.DialectCompatiblePlan<PlanValue, "sqlite">,
|
|
27
|
+
options: SqliteRenderOptions = {}
|
|
28
|
+
): SqliteRenderResult => {
|
|
29
|
+
const state: RenderState = {
|
|
30
|
+
params: [],
|
|
31
|
+
valueMappings: options.valueMappings,
|
|
32
|
+
ctes: [],
|
|
33
|
+
cteNames: new Set<string>(),
|
|
34
|
+
cteSources: new Map<string, unknown>()
|
|
35
|
+
}
|
|
36
|
+
const rendered = renderQueryAst(
|
|
37
|
+
Query.getAst(plan as Query.Plan.Any) as any,
|
|
38
|
+
state,
|
|
39
|
+
sqliteDialect
|
|
40
|
+
)
|
|
41
|
+
return {
|
|
42
|
+
sql: rendered.sql,
|
|
43
|
+
params: state.params,
|
|
44
|
+
projections: rendered.projections,
|
|
45
|
+
valueMappings: state.valueMappings
|
|
46
|
+
}
|
|
47
|
+
}
|