effect-qb 0.13.0 → 0.14.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/README.md +6 -1431
- package/dist/mysql.js +1678 -355
- package/dist/postgres/metadata.js +2724 -0
- package/dist/postgres.js +7197 -5433
- package/package.json +8 -10
- package/src/internal/column-state.ts +84 -10
- package/src/internal/column.ts +556 -34
- package/src/internal/datatypes/define.ts +0 -30
- package/src/internal/executor.ts +45 -11
- package/src/internal/expression-ast.ts +4 -0
- package/src/internal/expression.ts +1 -1
- package/src/internal/implication-runtime.ts +171 -0
- package/src/internal/mysql-query.ts +7173 -0
- package/src/internal/mysql-renderer.ts +2 -2
- package/src/internal/plan.ts +14 -4
- package/src/internal/{query-factory.ts → postgres-query.ts} +619 -167
- package/src/internal/postgres-renderer.ts +2 -2
- package/src/internal/postgres-schema-model.ts +144 -0
- package/src/internal/predicate-analysis.ts +10 -0
- package/src/internal/predicate-context.ts +112 -36
- package/src/internal/predicate-formula.ts +31 -19
- package/src/internal/predicate-normalize.ts +177 -106
- package/src/internal/predicate-runtime.ts +676 -0
- package/src/internal/query.ts +455 -39
- package/src/internal/renderer.ts +2 -2
- package/src/internal/runtime-schema.ts +74 -20
- package/src/internal/schema-ddl.ts +55 -0
- package/src/internal/schema-derivation.ts +93 -21
- package/src/internal/schema-expression.ts +44 -0
- package/src/internal/sql-expression-renderer.ts +95 -31
- package/src/internal/table-options.ts +87 -7
- package/src/internal/table.ts +104 -41
- package/src/mysql/column.ts +1 -0
- package/src/mysql/datatypes/index.ts +17 -2
- package/src/mysql/function/core.ts +1 -0
- package/src/mysql/function/index.ts +1 -0
- package/src/mysql/private/query.ts +1 -13
- package/src/mysql/query.ts +5 -0
- package/src/postgres/cast.ts +31 -0
- package/src/postgres/column.ts +26 -0
- package/src/postgres/datatypes/index.ts +40 -5
- package/src/postgres/function/core.ts +12 -0
- package/src/postgres/function/index.ts +2 -1
- package/src/postgres/function/json.ts +499 -2
- package/src/postgres/metadata.ts +31 -0
- package/src/postgres/private/query.ts +1 -13
- package/src/postgres/query.ts +5 -2
- package/src/postgres/schema-expression.ts +16 -0
- package/src/postgres/schema-management.ts +204 -0
- package/src/postgres/schema.ts +35 -0
- package/src/postgres/table.ts +307 -41
- package/src/postgres/type.ts +4 -0
- package/src/postgres.ts +14 -0
- package/CHANGELOG.md +0 -134
|
@@ -16,7 +16,7 @@ export interface MysqlRenderResult {
|
|
|
16
16
|
/**
|
|
17
17
|
* Renders the current query AST into MySQL-shaped SQL plus bind parameters.
|
|
18
18
|
*/
|
|
19
|
-
export const renderMysqlPlan = <PlanValue extends Query.QueryPlan<any, any, any, any, any, any, any, any, any>>(
|
|
19
|
+
export const renderMysqlPlan = <PlanValue extends Query.QueryPlan<any, any, any, any, any, any, any, any, any, any>>(
|
|
20
20
|
plan: Query.DialectCompatiblePlan<PlanValue, "mysql">
|
|
21
21
|
): MysqlRenderResult => {
|
|
22
22
|
const state: RenderState = {
|
|
@@ -25,7 +25,7 @@ export const renderMysqlPlan = <PlanValue extends Query.QueryPlan<any, any, any,
|
|
|
25
25
|
cteNames: new Set<string>()
|
|
26
26
|
}
|
|
27
27
|
const rendered = renderQueryAst(
|
|
28
|
-
Query.getAst(plan as Query.QueryPlan<any, any, any, any, any, any, any, any, any>) as any,
|
|
28
|
+
Query.getAst(plan as Query.QueryPlan<any, any, any, any, any, any, any, any, any, any>) as any,
|
|
29
29
|
state,
|
|
30
30
|
mysqlDialect
|
|
31
31
|
)
|
package/src/internal/plan.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Pipeable } from "effect/Pipeable"
|
|
2
|
+
import type { PredicateFormula } from "./predicate-formula.js"
|
|
2
3
|
|
|
3
4
|
/** Symbol used to attach logical-plan metadata to runtime values. */
|
|
4
5
|
export const TypeId: unique symbol = Symbol.for("effect-qb/Plan")
|
|
@@ -15,12 +16,21 @@ export type TypeId = typeof TypeId
|
|
|
15
16
|
export type SourceMode = "required" | "optional"
|
|
16
17
|
|
|
17
18
|
/** Source made available to a plan. */
|
|
18
|
-
export interface Source<
|
|
19
|
+
export interface Source<
|
|
20
|
+
Name extends string = string,
|
|
21
|
+
Mode extends SourceMode = SourceMode,
|
|
22
|
+
PresentFormula extends PredicateFormula = PredicateFormula,
|
|
23
|
+
PresenceWitness extends string = never
|
|
24
|
+
> {
|
|
19
25
|
readonly name: Name
|
|
20
26
|
readonly mode: Mode
|
|
21
27
|
readonly baseName?: string
|
|
28
|
+
readonly _presentFormula?: PresentFormula
|
|
29
|
+
readonly _presenceWitnesses?: readonly PresenceWitness[]
|
|
22
30
|
}
|
|
23
31
|
|
|
32
|
+
export type AnySource = Source<string, SourceMode, PredicateFormula, string>
|
|
33
|
+
|
|
24
34
|
/**
|
|
25
35
|
* Canonical static metadata stored on a plan.
|
|
26
36
|
*
|
|
@@ -31,7 +41,7 @@ export interface Source<Name extends string = string, Mode extends SourceMode =
|
|
|
31
41
|
export interface State<
|
|
32
42
|
Selection,
|
|
33
43
|
Required,
|
|
34
|
-
Available extends Record<string,
|
|
44
|
+
Available extends Record<string, AnySource>,
|
|
35
45
|
Dialect extends string
|
|
36
46
|
> {
|
|
37
47
|
readonly selection: Selection
|
|
@@ -50,14 +60,14 @@ export interface State<
|
|
|
50
60
|
export interface Plan<
|
|
51
61
|
Selection,
|
|
52
62
|
Required = never,
|
|
53
|
-
Available extends Record<string,
|
|
63
|
+
Available extends Record<string, AnySource> = {},
|
|
54
64
|
Dialect extends string = never
|
|
55
65
|
> extends Pipeable {
|
|
56
66
|
readonly [TypeId]: State<Selection, Required, Available, Dialect>
|
|
57
67
|
}
|
|
58
68
|
|
|
59
69
|
/** Convenience alias for any plan-like value. */
|
|
60
|
-
export type Any = Plan<any, any, Record<string,
|
|
70
|
+
export type Any = Plan<any, any, Record<string, AnySource>, string>
|
|
61
71
|
/** Extracts a plan's selection shape. */
|
|
62
72
|
export type SelectionOf<Value extends Any> = Value[typeof TypeId]["selection"]
|
|
63
73
|
/** Extracts a plan's effective dialect. */
|