effect-qb 4.0.0-beta.66 → 4.0.0-beta.92
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 +5 -2
- package/dist/index.js +9373 -0
- package/dist/mysql.js +3917 -2572
- package/dist/postgres/metadata.js +2491 -1373
- package/dist/postgres.js +5450 -5155
- package/dist/sqlite.js +6891 -5528
- package/dist/standard.js +9327 -0
- package/package.json +9 -2
- package/src/casing.ts +71 -0
- package/src/index.ts +2 -0
- package/src/internal/casing.ts +89 -0
- package/src/internal/coercion/rules.ts +13 -1
- package/src/internal/column-state.ts +21 -15
- package/src/internal/column.ts +44 -7
- package/src/internal/datatypes/define.ts +7 -1
- package/src/internal/datatypes/enrich.ts +23 -0
- package/src/internal/datatypes/lookup.ts +81 -25
- package/src/internal/datatypes/matrix.ts +903 -0
- package/src/internal/datatypes/shape.ts +2 -0
- package/src/internal/derived-table.ts +4 -36
- package/src/{mysql/internal/sql-expression-renderer.ts → internal/dialect-renderers/mysql.ts} +552 -361
- package/src/{postgres/internal/sql-expression-renderer.ts → internal/dialect-renderers/postgres.ts} +657 -400
- package/src/{sqlite/internal/sql-expression-renderer.ts → internal/dialect-renderers/sqlite.ts} +505 -347
- package/src/internal/dialect.ts +35 -0
- package/src/internal/dsl-mutation-runtime.ts +12 -162
- package/src/internal/dsl-plan-runtime.ts +10 -138
- package/src/internal/dsl-query-runtime.ts +5 -79
- package/src/internal/dsl-transaction-ddl-runtime.ts +41 -65
- package/src/internal/executor.ts +14 -16
- package/src/internal/grouping-key.ts +87 -20
- package/src/internal/implication-runtime.ts +1 -1
- package/src/internal/json/path-access.ts +351 -0
- package/src/internal/predicate/runtime.ts +3 -0
- package/src/internal/query.d.ts +38 -11
- package/src/internal/query.ts +64 -25
- package/src/internal/renderer.ts +26 -14
- package/src/internal/runtime/normalize.ts +12 -5
- package/src/internal/scalar.ts +7 -1
- package/src/internal/schema-derivation.d.ts +7 -7
- package/src/internal/schema-derivation.ts +9 -9
- package/src/internal/schema-expression.ts +2 -2
- package/src/internal/sql-expression-renderer.ts +19 -0
- package/src/internal/standard-dsl.ts +6975 -0
- package/src/internal/table-options.ts +126 -66
- package/src/internal/table.ts +652 -219
- package/src/mysql/column-extension.ts +3 -0
- package/src/mysql/column.ts +8 -9
- package/src/mysql/datatypes/index.ts +4 -2
- package/src/mysql/datatypes/spec.ts +6 -176
- package/src/mysql/executor.ts +7 -7
- package/src/mysql/internal/dialect.ts +9 -4
- package/src/mysql/internal/dsl.ts +309 -154
- package/src/mysql/internal/renderer.ts +6 -2
- package/src/mysql/json.ts +7 -2
- package/src/mysql/query-extension.ts +16 -0
- package/src/mysql/renderer.ts +37 -3
- package/src/mysql/type.ts +60 -0
- package/src/mysql.ts +7 -13
- package/src/postgres/check.ts +1 -0
- package/src/postgres/column-extension.ts +28 -0
- package/src/postgres/column.ts +2 -8
- package/src/postgres/datatypes/index.d.ts +2 -1
- package/src/postgres/datatypes/index.ts +4 -2
- package/src/postgres/datatypes/spec.ts +6 -260
- package/src/postgres/executor.ts +7 -7
- package/src/postgres/foreign-key.ts +24 -0
- package/src/postgres/function/core.ts +1 -3
- package/src/postgres/function/index.ts +1 -17
- package/src/postgres/index.ts +1 -0
- package/src/postgres/internal/dialect.ts +9 -4
- package/src/postgres/internal/dsl.ts +303 -163
- package/src/postgres/internal/renderer.ts +6 -2
- package/src/postgres/internal/schema-ddl.ts +22 -10
- package/src/postgres/internal/schema-model.ts +238 -7
- package/src/postgres/json-extension.ts +7 -0
- package/src/postgres/json.ts +762 -173
- package/src/postgres/jsonb.ts +37 -0
- package/src/postgres/primary-key.ts +24 -0
- package/src/postgres/query-extension.ts +2 -0
- package/src/postgres/renderer.ts +37 -3
- package/src/postgres/schema-management.ts +12 -11
- package/src/postgres/schema.ts +106 -15
- package/src/postgres/table.ts +205 -530
- package/src/postgres/type.ts +93 -10
- package/src/postgres/unique.ts +32 -0
- package/src/postgres.ts +20 -16
- package/src/sqlite/column-extension.ts +3 -0
- package/src/sqlite/column.ts +8 -9
- package/src/sqlite/datatypes/index.ts +4 -2
- package/src/sqlite/datatypes/spec.ts +6 -94
- package/src/sqlite/executor.ts +7 -7
- package/src/sqlite/internal/dialect.ts +9 -4
- package/src/sqlite/internal/dsl.ts +298 -154
- package/src/sqlite/internal/renderer.ts +6 -2
- package/src/sqlite/json.ts +8 -2
- package/src/sqlite/query-extension.ts +2 -0
- package/src/sqlite/renderer.ts +37 -3
- package/src/sqlite/type.ts +40 -0
- package/src/sqlite.ts +7 -13
- package/src/standard/cast.ts +113 -0
- package/src/standard/check.ts +17 -0
- package/src/standard/column.ts +163 -0
- package/src/standard/datatypes/index.ts +83 -0
- package/src/standard/datatypes/spec.ts +12 -0
- package/src/standard/dialect.ts +40 -0
- package/src/standard/foreign-key.ts +37 -0
- package/src/standard/function/aggregate.ts +2 -0
- package/src/standard/function/core.ts +2 -0
- package/src/standard/function/index.ts +18 -0
- package/src/standard/function/string.ts +2 -0
- package/src/standard/function/temporal.ts +78 -0
- package/src/standard/function/window.ts +2 -0
- package/src/standard/index.ts +17 -0
- package/src/standard/internal/renderer.ts +45 -0
- package/src/standard/json.ts +883 -0
- package/src/standard/primary-key.ts +17 -0
- package/src/standard/query.ts +152 -0
- package/src/standard/renderer.ts +49 -0
- package/src/standard/table.ts +151 -0
- package/src/standard/unique.ts +17 -0
- package/src/standard.ts +32 -0
- package/src/internal/aggregation-validation.ts +0 -57
- package/src/internal/table.d.ts +0 -180
- package/src/mysql/table.ts +0 -186
- package/src/postgres/cast.ts +0 -45
- package/src/sqlite/table.ts +0 -175
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { pipeArguments } from "effect/Pipeable"
|
|
1
|
+
import { pipeArguments, type Pipeable } from "effect/Pipeable"
|
|
2
2
|
import * as Schema from "effect/Schema"
|
|
3
3
|
|
|
4
4
|
import { mysqlDatatypes } from "../datatypes/index.js"
|
|
@@ -6,6 +6,12 @@ import { mysqlDatatypes } from "../datatypes/index.js"
|
|
|
6
6
|
import * as Expression from "../../internal/scalar.js"
|
|
7
7
|
import * as Plan from "../../internal/row-set.js"
|
|
8
8
|
import * as Table from "../../internal/table.js"
|
|
9
|
+
import type {
|
|
10
|
+
LiteralStringInput,
|
|
11
|
+
NonEmptyStringInput,
|
|
12
|
+
SafeSqlIdentifierInput,
|
|
13
|
+
SafeSqlIdentifierPathInput
|
|
14
|
+
} from "../../internal/table-options.js"
|
|
9
15
|
import type { CastTargetError, OperandCompatibilityError } from "../../internal/coercion/errors.js"
|
|
10
16
|
import type { RuntimeOfDbType } from "../../internal/coercion/analysis.js"
|
|
11
17
|
import type { CanCastDbType, CanCompareDbTypes, CanContainDbTypes, CanTextuallyCoerceDbType } from "../../internal/coercion/rules.js"
|
|
@@ -71,6 +77,7 @@ import {
|
|
|
71
77
|
type ScopedNamesOfPlan,
|
|
72
78
|
type SelectionOfPlan,
|
|
73
79
|
type SelectionShape,
|
|
80
|
+
type SelectionProjectionAliasCollisionConstraint,
|
|
74
81
|
type SetCompatiblePlan,
|
|
75
82
|
type SetCompatibleRightPlan,
|
|
76
83
|
type SchemaTableLike,
|
|
@@ -135,7 +142,7 @@ import * as ProjectionAlias from "../../internal/projection-alias.js"
|
|
|
135
142
|
import * as QueryAst from "../../internal/query-ast.js"
|
|
136
143
|
import { normalizeColumnList } from "../../internal/table-options.js"
|
|
137
144
|
|
|
138
|
-
type MutationTargetLike = Table.AnyTable<Dialect>
|
|
145
|
+
type MutationTargetLike = Table.AnyTable<Dialect | "standard">
|
|
139
146
|
type MutationTargetTuple = readonly [MutationTargetLike, MutationTargetLike, ...MutationTargetLike[]]
|
|
140
147
|
type MutationTargetInput = MutationTargetLike | MutationTargetTuple
|
|
141
148
|
|
|
@@ -711,7 +718,7 @@ type NumericExpressionDialectInput<
|
|
|
711
718
|
BoolDb extends Expression.DbType.Any,
|
|
712
719
|
TimestampDb extends Expression.DbType.Any,
|
|
713
720
|
NullDb extends Expression.DbType.Any
|
|
714
|
-
> = Exclude<DialectOfDialectNumericInput<Value, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb>, Dialect> extends never
|
|
721
|
+
> = Exclude<DialectOfDialectNumericInput<Value, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb>, Dialect | "standard"> extends never
|
|
715
722
|
? unknown
|
|
716
723
|
: {
|
|
717
724
|
readonly __effect_qb_error__: "effect-qb: numeric expressions cannot mix dialects"
|
|
@@ -804,6 +811,35 @@ type DialectExpressionArray<
|
|
|
804
811
|
? Tuple
|
|
805
812
|
: never
|
|
806
813
|
|
|
814
|
+
type ExtractFunctionFieldInput<
|
|
815
|
+
Value extends ExpressionInput
|
|
816
|
+
> = Value extends string
|
|
817
|
+
? SafeSqlIdentifierInput<Value>
|
|
818
|
+
: Value extends { readonly [ExpressionAst.TypeId]: ExpressionAst.LiteralNode<infer Field extends string> }
|
|
819
|
+
? SafeSqlIdentifierInput<Field> extends never ? never : Value
|
|
820
|
+
: never
|
|
821
|
+
|
|
822
|
+
type GenericFunctionNameInput<Name extends string> =
|
|
823
|
+
Name extends "current_date" | "extract" ? never : SafeSqlIdentifierPathInput<Name>
|
|
824
|
+
|
|
825
|
+
type FunctionCallApi = {
|
|
826
|
+
(name: "current_date"): Expression.Any
|
|
827
|
+
<Field extends string, Source extends ExpressionInput>(
|
|
828
|
+
name: "extract",
|
|
829
|
+
field: SafeSqlIdentifierInput<Field>,
|
|
830
|
+
source: Source
|
|
831
|
+
): Expression.Any
|
|
832
|
+
<Field extends Expression.Any, Source extends ExpressionInput>(
|
|
833
|
+
name: "extract",
|
|
834
|
+
field: Field & ExtractFunctionFieldInput<Field>,
|
|
835
|
+
source: Source
|
|
836
|
+
): Expression.Any
|
|
837
|
+
<Name extends string, Args extends readonly ExpressionInput[]>(
|
|
838
|
+
name: GenericFunctionNameInput<Name>,
|
|
839
|
+
...args: Args
|
|
840
|
+
): Expression.Any
|
|
841
|
+
}
|
|
842
|
+
|
|
807
843
|
/** Normalized expression tuple for generic string operator inputs. */
|
|
808
844
|
type DialectStringExpressionTuple<
|
|
809
845
|
Values extends readonly ExpressionInput[],
|
|
@@ -1070,6 +1106,9 @@ type JsonPathInput = JsonPath.Path<any> | JsonPath.CanonicalSegment
|
|
|
1070
1106
|
|
|
1071
1107
|
type JsonQueryInput = JsonPath.Path<any> | StringExpressionInput
|
|
1072
1108
|
|
|
1109
|
+
type JsonQueryValue<Query extends JsonQueryInput> =
|
|
1110
|
+
Query extends string ? LiteralStringInput<Query> : Query
|
|
1111
|
+
|
|
1073
1112
|
type JsonPathOutputOf<
|
|
1074
1113
|
Root,
|
|
1075
1114
|
Target extends JsonPathInput,
|
|
@@ -1527,7 +1566,7 @@ const profile: QueryDialectProfile<Dialect, TextDb, NumericDb, BoolDb, Timestamp
|
|
|
1527
1566
|
type: mysqlDatatypes
|
|
1528
1567
|
}
|
|
1529
1568
|
const ValuesInputProto = {
|
|
1530
|
-
pipe(this:
|
|
1569
|
+
pipe(this: Pipeable) {
|
|
1531
1570
|
return pipeArguments(this, arguments)
|
|
1532
1571
|
}
|
|
1533
1572
|
}
|
|
@@ -1625,7 +1664,7 @@ const profile: QueryDialectProfile<Dialect, TextDb, NumericDb, BoolDb, Timestamp
|
|
|
1625
1664
|
value: Expression.Any,
|
|
1626
1665
|
target: Expression.Any
|
|
1627
1666
|
): Expression.Any => {
|
|
1628
|
-
const ast = (value as
|
|
1667
|
+
const ast = (value as Expression.Any & { readonly [ExpressionAst.TypeId]: ExpressionAst.Any })[ExpressionAst.TypeId]
|
|
1629
1668
|
if (ast.kind !== "literal") {
|
|
1630
1669
|
return value
|
|
1631
1670
|
}
|
|
@@ -1646,8 +1685,8 @@ const profile: QueryDialectProfile<Dialect, TextDb, NumericDb, BoolDb, Timestamp
|
|
|
1646
1685
|
left: Expression.Any,
|
|
1647
1686
|
right: Expression.Any
|
|
1648
1687
|
): readonly [Expression.Any, Expression.Any] => {
|
|
1649
|
-
const leftAst = (left as
|
|
1650
|
-
const rightAst = (right as
|
|
1688
|
+
const leftAst = (left as Expression.Any & { readonly [ExpressionAst.TypeId]: ExpressionAst.Any })[ExpressionAst.TypeId]
|
|
1689
|
+
const rightAst = (right as Expression.Any & { readonly [ExpressionAst.TypeId]: ExpressionAst.Any })[ExpressionAst.TypeId]
|
|
1651
1690
|
if (leftAst.kind === "literal" && rightAst.kind !== "literal") {
|
|
1652
1691
|
return [retargetLiteralExpression(left, right), right]
|
|
1653
1692
|
}
|
|
@@ -1680,7 +1719,7 @@ const profile: QueryDialectProfile<Dialect, TextDb, NumericDb, BoolDb, Timestamp
|
|
|
1680
1719
|
): readonly Expression.Any[] => {
|
|
1681
1720
|
const flattened: Array<Expression.Any> = []
|
|
1682
1721
|
for (const value of values) {
|
|
1683
|
-
const ast = (value as
|
|
1722
|
+
const ast = (value as Expression.Any & { readonly [ExpressionAst.TypeId]: ExpressionAst.Any })[ExpressionAst.TypeId]
|
|
1684
1723
|
if (ast.kind === kind) {
|
|
1685
1724
|
flattened.push(...ast.values)
|
|
1686
1725
|
} else {
|
|
@@ -1726,7 +1765,33 @@ const profile: QueryDialectProfile<Dialect, TextDb, NumericDb, BoolDb, Timestamp
|
|
|
1726
1765
|
if (operations.every((operation) => typeof operation === "function")) {
|
|
1727
1766
|
return pipeArguments(this, arguments)
|
|
1728
1767
|
}
|
|
1729
|
-
|
|
1768
|
+
const valuesForMixedPipe = (value: unknown): readonly Expression.Any[] => {
|
|
1769
|
+
if (typeof value !== "object" || value === null || !(Expression.TypeId in value)) {
|
|
1770
|
+
return []
|
|
1771
|
+
}
|
|
1772
|
+
const expression = value as Expression.Any & {
|
|
1773
|
+
readonly [ExpressionAst.TypeId]: ExpressionAst.Any
|
|
1774
|
+
}
|
|
1775
|
+
const ast = expression[ExpressionAst.TypeId]
|
|
1776
|
+
if (ast.kind === kind) {
|
|
1777
|
+
return (ast as {
|
|
1778
|
+
readonly values: readonly Expression.Any[]
|
|
1779
|
+
}).values
|
|
1780
|
+
}
|
|
1781
|
+
return [expression]
|
|
1782
|
+
}
|
|
1783
|
+
let current: unknown = this
|
|
1784
|
+
for (const operation of operations) {
|
|
1785
|
+
if (typeof operation === "function") {
|
|
1786
|
+
current = (operation as (value: unknown) => unknown)(current)
|
|
1787
|
+
continue
|
|
1788
|
+
}
|
|
1789
|
+
current = makeVariadicBooleanExpression(
|
|
1790
|
+
kind,
|
|
1791
|
+
[...valuesForMixedPipe(current), toDialectExpression(operation as ExpressionInput)] as const
|
|
1792
|
+
)
|
|
1793
|
+
}
|
|
1794
|
+
return current
|
|
1730
1795
|
}
|
|
1731
1796
|
})
|
|
1732
1797
|
|
|
@@ -1747,9 +1812,6 @@ const profile: QueryDialectProfile<Dialect, TextDb, NumericDb, BoolDb, Timestamp
|
|
|
1747
1812
|
const partitionBy = [...(spec?.partitionBy ?? [])] as unknown as PartitionBy
|
|
1748
1813
|
const orderBy = (spec?.orderBy ?? []).map((term) => {
|
|
1749
1814
|
const direction = term.direction ?? "asc"
|
|
1750
|
-
if (direction !== "asc" && direction !== "desc") {
|
|
1751
|
-
throw new Error("window order direction must be asc or desc")
|
|
1752
|
-
}
|
|
1753
1815
|
return {
|
|
1754
1816
|
value: term.value,
|
|
1755
1817
|
direction
|
|
@@ -1890,7 +1952,8 @@ type BinaryPredicateExpression<
|
|
|
1890
1952
|
>(
|
|
1891
1953
|
...args: ComparableArgs<Left, Right, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb, "eq">
|
|
1892
1954
|
): BinaryPredicateExpression<Left, Right, "eq"> => {
|
|
1893
|
-
const
|
|
1955
|
+
const left = args[0] as Left
|
|
1956
|
+
const right = args[1] as Right
|
|
1894
1957
|
return buildBinaryPredicate(left as ExpressionInput, right as ExpressionInput, "eq")
|
|
1895
1958
|
}
|
|
1896
1959
|
|
|
@@ -1900,7 +1963,8 @@ type BinaryPredicateExpression<
|
|
|
1900
1963
|
>(
|
|
1901
1964
|
...args: ComparableArgs<Left, Right, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb, "neq">
|
|
1902
1965
|
): BinaryPredicateExpression<Left, Right, "neq"> => {
|
|
1903
|
-
const
|
|
1966
|
+
const left = args[0] as Left
|
|
1967
|
+
const right = args[1] as Right
|
|
1904
1968
|
return buildBinaryPredicate(left as ExpressionInput, right as ExpressionInput, "neq")
|
|
1905
1969
|
}
|
|
1906
1970
|
|
|
@@ -1910,7 +1974,8 @@ type BinaryPredicateExpression<
|
|
|
1910
1974
|
>(
|
|
1911
1975
|
...args: ComparableArgs<Left, Right, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb, "lt">
|
|
1912
1976
|
): BinaryPredicateExpression<Left, Right, "lt"> => {
|
|
1913
|
-
const
|
|
1977
|
+
const left = args[0] as Left
|
|
1978
|
+
const right = args[1] as Right
|
|
1914
1979
|
return buildBinaryPredicate(left as ExpressionInput, right as ExpressionInput, "lt")
|
|
1915
1980
|
}
|
|
1916
1981
|
|
|
@@ -1920,7 +1985,8 @@ type BinaryPredicateExpression<
|
|
|
1920
1985
|
>(
|
|
1921
1986
|
...args: ComparableArgs<Left, Right, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb, "lte">
|
|
1922
1987
|
): BinaryPredicateExpression<Left, Right, "lte"> => {
|
|
1923
|
-
const
|
|
1988
|
+
const left = args[0] as Left
|
|
1989
|
+
const right = args[1] as Right
|
|
1924
1990
|
return buildBinaryPredicate(left as ExpressionInput, right as ExpressionInput, "lte")
|
|
1925
1991
|
}
|
|
1926
1992
|
|
|
@@ -1930,7 +1996,8 @@ type BinaryPredicateExpression<
|
|
|
1930
1996
|
>(
|
|
1931
1997
|
...args: ComparableArgs<Left, Right, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb, "gt">
|
|
1932
1998
|
): BinaryPredicateExpression<Left, Right, "gt"> => {
|
|
1933
|
-
const
|
|
1999
|
+
const left = args[0] as Left
|
|
2000
|
+
const right = args[1] as Right
|
|
1934
2001
|
return buildBinaryPredicate(left as ExpressionInput, right as ExpressionInput, "gt")
|
|
1935
2002
|
}
|
|
1936
2003
|
|
|
@@ -1940,7 +2007,8 @@ type BinaryPredicateExpression<
|
|
|
1940
2007
|
>(
|
|
1941
2008
|
...args: ComparableArgs<Left, Right, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb, "gte">
|
|
1942
2009
|
): BinaryPredicateExpression<Left, Right, "gte"> => {
|
|
1943
|
-
const
|
|
2010
|
+
const left = args[0] as Left
|
|
2011
|
+
const right = args[1] as Right
|
|
1944
2012
|
return buildBinaryPredicate(left as ExpressionInput, right as ExpressionInput, "gte")
|
|
1945
2013
|
}
|
|
1946
2014
|
|
|
@@ -1950,7 +2018,8 @@ type BinaryPredicateExpression<
|
|
|
1950
2018
|
>(
|
|
1951
2019
|
...args: TextArgs<Left, Right, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb, "like">
|
|
1952
2020
|
): BinaryPredicateExpression<Left, Right, "like"> => {
|
|
1953
|
-
const
|
|
2021
|
+
const left = args[0] as Left
|
|
2022
|
+
const right = args[1] as Right
|
|
1954
2023
|
return buildBinaryPredicate(left as ExpressionInput, right as ExpressionInput, "like")
|
|
1955
2024
|
}
|
|
1956
2025
|
|
|
@@ -1960,7 +2029,8 @@ type BinaryPredicateExpression<
|
|
|
1960
2029
|
>(
|
|
1961
2030
|
...args: TextArgs<Left, Right, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb, "ilike">
|
|
1962
2031
|
): BinaryPredicateExpression<Left, Right, "ilike"> => {
|
|
1963
|
-
const
|
|
2032
|
+
const left = args[0] as Left
|
|
2033
|
+
const right = args[1] as Right
|
|
1964
2034
|
return buildBinaryPredicate(left as ExpressionInput, right as ExpressionInput, "ilike")
|
|
1965
2035
|
}
|
|
1966
2036
|
|
|
@@ -1970,7 +2040,8 @@ type BinaryPredicateExpression<
|
|
|
1970
2040
|
>(
|
|
1971
2041
|
...args: TextArgs<Left, Right, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb, "regexMatch">
|
|
1972
2042
|
): BinaryPredicateExpression<Left, Right, "regexMatch"> => {
|
|
1973
|
-
const
|
|
2043
|
+
const left = args[0] as Left
|
|
2044
|
+
const right = args[1] as Right
|
|
1974
2045
|
return buildBinaryPredicate(left as ExpressionInput, right as ExpressionInput, "regexMatch")
|
|
1975
2046
|
}
|
|
1976
2047
|
|
|
@@ -1980,7 +2051,8 @@ type BinaryPredicateExpression<
|
|
|
1980
2051
|
>(
|
|
1981
2052
|
...args: TextArgs<Left, Right, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb, "regexIMatch">
|
|
1982
2053
|
): BinaryPredicateExpression<Left, Right, "regexIMatch"> => {
|
|
1983
|
-
const
|
|
2054
|
+
const left = args[0] as Left
|
|
2055
|
+
const right = args[1] as Right
|
|
1984
2056
|
return buildBinaryPredicate(left as ExpressionInput, right as ExpressionInput, "regexIMatch")
|
|
1985
2057
|
}
|
|
1986
2058
|
|
|
@@ -1990,7 +2062,8 @@ type BinaryPredicateExpression<
|
|
|
1990
2062
|
>(
|
|
1991
2063
|
...args: TextArgs<Left, Right, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb, "regexNotMatch">
|
|
1992
2064
|
): BinaryPredicateExpression<Left, Right, "regexNotMatch"> => {
|
|
1993
|
-
const
|
|
2065
|
+
const left = args[0] as Left
|
|
2066
|
+
const right = args[1] as Right
|
|
1994
2067
|
return buildBinaryPredicate(left as ExpressionInput, right as ExpressionInput, "regexNotMatch")
|
|
1995
2068
|
}
|
|
1996
2069
|
|
|
@@ -2000,7 +2073,8 @@ type BinaryPredicateExpression<
|
|
|
2000
2073
|
>(
|
|
2001
2074
|
...args: TextArgs<Left, Right, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb, "regexNotIMatch">
|
|
2002
2075
|
): BinaryPredicateExpression<Left, Right, "regexNotIMatch"> => {
|
|
2003
|
-
const
|
|
2076
|
+
const left = args[0] as Left
|
|
2077
|
+
const right = args[1] as Right
|
|
2004
2078
|
return buildBinaryPredicate(left as ExpressionInput, right as ExpressionInput, "regexNotIMatch")
|
|
2005
2079
|
}
|
|
2006
2080
|
|
|
@@ -2010,7 +2084,8 @@ type BinaryPredicateExpression<
|
|
|
2010
2084
|
>(
|
|
2011
2085
|
...args: ComparableArgs<Left, Right, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb, "isDistinctFrom">
|
|
2012
2086
|
): BinaryPredicateExpression<Left, Right, "isDistinctFrom", "never"> => {
|
|
2013
|
-
const
|
|
2087
|
+
const left = args[0] as Left
|
|
2088
|
+
const right = args[1] as Right
|
|
2014
2089
|
return buildBinaryPredicate(left as ExpressionInput, right as ExpressionInput, "isDistinctFrom", "never")
|
|
2015
2090
|
}
|
|
2016
2091
|
|
|
@@ -2020,7 +2095,8 @@ type BinaryPredicateExpression<
|
|
|
2020
2095
|
>(
|
|
2021
2096
|
...args: ComparableArgs<Left, Right, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb, "isNotDistinctFrom">
|
|
2022
2097
|
): BinaryPredicateExpression<Left, Right, "isNotDistinctFrom", "never"> => {
|
|
2023
|
-
const
|
|
2098
|
+
const left = args[0] as Left
|
|
2099
|
+
const right = args[1] as Right
|
|
2024
2100
|
return buildBinaryPredicate(left as ExpressionInput, right as ExpressionInput, "isNotDistinctFrom", "never")
|
|
2025
2101
|
}
|
|
2026
2102
|
|
|
@@ -2171,62 +2247,62 @@ type BinaryPredicateExpression<
|
|
|
2171
2247
|
})
|
|
2172
2248
|
|
|
2173
2249
|
const range = <Kind extends string, Subtype extends Expression.DbType.Any>(
|
|
2174
|
-
kind: Kind
|
|
2250
|
+
kind: NonEmptyStringInput<Kind>,
|
|
2175
2251
|
subtype: Subtype
|
|
2176
2252
|
): Expression.DbType.Range<Dialect, Subtype, Kind> => ({
|
|
2177
2253
|
dialect: profile.dialect,
|
|
2178
|
-
kind,
|
|
2254
|
+
kind: kind as Kind,
|
|
2179
2255
|
subtype
|
|
2180
2256
|
})
|
|
2181
2257
|
|
|
2182
2258
|
const multirange = <Kind extends string, Subtype extends Expression.DbType.Any>(
|
|
2183
|
-
kind: Kind
|
|
2259
|
+
kind: NonEmptyStringInput<Kind>,
|
|
2184
2260
|
subtype: Subtype
|
|
2185
2261
|
): Expression.DbType.Multirange<Dialect, Subtype, Kind> => ({
|
|
2186
2262
|
dialect: profile.dialect,
|
|
2187
|
-
kind,
|
|
2263
|
+
kind: kind as Kind,
|
|
2188
2264
|
subtype
|
|
2189
2265
|
})
|
|
2190
2266
|
|
|
2191
2267
|
const record = <Kind extends string, Fields extends Record<string, Expression.DbType.Any>>(
|
|
2192
|
-
kind: Kind
|
|
2268
|
+
kind: NonEmptyStringInput<Kind>,
|
|
2193
2269
|
fields: Fields
|
|
2194
2270
|
): Expression.DbType.Composite<Dialect, Fields, Kind> => ({
|
|
2195
2271
|
dialect: profile.dialect,
|
|
2196
|
-
kind,
|
|
2272
|
+
kind: kind as Kind,
|
|
2197
2273
|
fields
|
|
2198
2274
|
})
|
|
2199
2275
|
|
|
2200
2276
|
const domain = <Kind extends string, Base extends Expression.DbType.Any>(
|
|
2201
|
-
kind: Kind
|
|
2277
|
+
kind: NonEmptyStringInput<Kind>,
|
|
2202
2278
|
base: Base
|
|
2203
2279
|
): Expression.DbType.Domain<Dialect, Base, Kind> => ({
|
|
2204
2280
|
dialect: profile.dialect,
|
|
2205
|
-
kind,
|
|
2281
|
+
kind: kind as Kind,
|
|
2206
2282
|
base
|
|
2207
2283
|
})
|
|
2208
2284
|
|
|
2209
2285
|
const enum_ = <Kind extends string>(
|
|
2210
|
-
kind: Kind
|
|
2286
|
+
kind: NonEmptyStringInput<Kind>
|
|
2211
2287
|
): Expression.DbType.Enum<Dialect, Kind> => ({
|
|
2212
2288
|
dialect: profile.dialect,
|
|
2213
|
-
kind,
|
|
2289
|
+
kind: kind as Kind,
|
|
2214
2290
|
variant: "enum"
|
|
2215
2291
|
})
|
|
2216
2292
|
|
|
2217
2293
|
const set = <Kind extends string>(
|
|
2218
|
-
kind: Kind
|
|
2294
|
+
kind: NonEmptyStringInput<Kind>
|
|
2219
2295
|
): Expression.DbType.Set<Dialect, Kind> => ({
|
|
2220
2296
|
dialect: profile.dialect,
|
|
2221
|
-
kind,
|
|
2297
|
+
kind: kind as Kind,
|
|
2222
2298
|
variant: "set"
|
|
2223
2299
|
})
|
|
2224
2300
|
|
|
2225
2301
|
const custom = <Kind extends string>(
|
|
2226
|
-
kind: Kind
|
|
2302
|
+
kind: NonEmptyStringInput<Kind>
|
|
2227
2303
|
): Expression.DbType.Base<Dialect, Kind> => ({
|
|
2228
2304
|
dialect: profile.dialect,
|
|
2229
|
-
kind
|
|
2305
|
+
kind: kind as Kind
|
|
2230
2306
|
})
|
|
2231
2307
|
|
|
2232
2308
|
const driverValueMapping = <Db extends Expression.DbType.Any>(
|
|
@@ -3034,9 +3110,12 @@ type BinaryPredicateExpression<
|
|
|
3034
3110
|
}
|
|
3035
3111
|
)
|
|
3036
3112
|
|
|
3037
|
-
const jsonPathExists = <
|
|
3113
|
+
const jsonPathExists = <
|
|
3114
|
+
Base extends JsonExpressionLike<any>,
|
|
3115
|
+
Query extends JsonQueryInput
|
|
3116
|
+
>(
|
|
3038
3117
|
base: Base,
|
|
3039
|
-
query:
|
|
3118
|
+
query: JsonQueryValue<Query>
|
|
3040
3119
|
) => {
|
|
3041
3120
|
if (isJsonPathValue(query)) {
|
|
3042
3121
|
return buildJsonNodeExpression(
|
|
@@ -3084,9 +3163,12 @@ type BinaryPredicateExpression<
|
|
|
3084
3163
|
}
|
|
3085
3164
|
)
|
|
3086
3165
|
|
|
3087
|
-
const jsonPathMatch = <
|
|
3166
|
+
const jsonPathMatch = <
|
|
3167
|
+
Base extends JsonExpressionLike<any>,
|
|
3168
|
+
Query extends JsonQueryInput
|
|
3169
|
+
>(
|
|
3088
3170
|
base: Base,
|
|
3089
|
-
query:
|
|
3171
|
+
query: JsonQueryValue<Query>
|
|
3090
3172
|
) => {
|
|
3091
3173
|
if (isJsonPathValue(query)) {
|
|
3092
3174
|
return buildJsonNodeExpression(
|
|
@@ -3313,7 +3395,8 @@ type BinaryPredicateExpression<
|
|
|
3313
3395
|
>(
|
|
3314
3396
|
...args: ContainmentArgs<Left, Right, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb, "contains">
|
|
3315
3397
|
): BinaryPredicateExpression<Left, Right, "contains"> => {
|
|
3316
|
-
const
|
|
3398
|
+
const left = args[0] as Left
|
|
3399
|
+
const right = args[1] as Right
|
|
3317
3400
|
return buildBinaryPredicate(left as ExpressionInput, right as ExpressionInput, "contains")
|
|
3318
3401
|
}
|
|
3319
3402
|
|
|
@@ -3323,7 +3406,8 @@ type BinaryPredicateExpression<
|
|
|
3323
3406
|
>(
|
|
3324
3407
|
...args: ContainmentArgs<Left, Right, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb, "containedBy">
|
|
3325
3408
|
): BinaryPredicateExpression<Left, Right, "containedBy"> => {
|
|
3326
|
-
const
|
|
3409
|
+
const left = args[0] as Left
|
|
3410
|
+
const right = args[1] as Right
|
|
3327
3411
|
return buildBinaryPredicate(left as ExpressionInput, right as ExpressionInput, "containedBy")
|
|
3328
3412
|
}
|
|
3329
3413
|
|
|
@@ -3333,7 +3417,8 @@ type BinaryPredicateExpression<
|
|
|
3333
3417
|
>(
|
|
3334
3418
|
...args: ContainmentArgs<Left, Right, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb, "overlaps">
|
|
3335
3419
|
): BinaryPredicateExpression<Left, Right, "overlaps"> => {
|
|
3336
|
-
const
|
|
3420
|
+
const left = args[0] as Left
|
|
3421
|
+
const right = args[1] as Right
|
|
3337
3422
|
return buildBinaryPredicate(left as ExpressionInput, right as ExpressionInput, "overlaps")
|
|
3338
3423
|
}
|
|
3339
3424
|
|
|
@@ -3760,12 +3845,9 @@ type BinaryPredicateExpression<
|
|
|
3760
3845
|
>
|
|
3761
3846
|
}
|
|
3762
3847
|
|
|
3763
|
-
const call =
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
>(
|
|
3767
|
-
name: Name,
|
|
3768
|
-
...args: Args
|
|
3848
|
+
const call: FunctionCallApi = (
|
|
3849
|
+
name: string,
|
|
3850
|
+
...args: readonly ExpressionInput[]
|
|
3769
3851
|
): Expression.Any => {
|
|
3770
3852
|
const expressions = args.map((value) => toDialectExpression(value)) as readonly Expression.Any[]
|
|
3771
3853
|
return makeExpression({
|
|
@@ -4001,9 +4083,6 @@ type BinaryPredicateExpression<
|
|
|
4001
4083
|
ExpressionAst.ExcludedNode<AstOf<Value> extends ExpressionAst.ColumnNode<any, infer ColumnName extends string> ? ColumnName : string>
|
|
4002
4084
|
> => {
|
|
4003
4085
|
const ast = ((value as unknown) as Expression.Any & { readonly [ExpressionAst.TypeId]: ExpressionAst.Any })[ExpressionAst.TypeId]
|
|
4004
|
-
if (ast.kind !== "column") {
|
|
4005
|
-
throw new Error("excluded(...) only accepts bound table columns")
|
|
4006
|
-
}
|
|
4007
4086
|
return makeExpression({
|
|
4008
4087
|
runtime: undefined as Expression.RuntimeOf<Value>,
|
|
4009
4088
|
dbType: value[Expression.TypeId].dbType as Expression.DbTypeOf<Value>,
|
|
@@ -4016,7 +4095,7 @@ type BinaryPredicateExpression<
|
|
|
4016
4095
|
dependencies: {}
|
|
4017
4096
|
}, {
|
|
4018
4097
|
kind: "excluded",
|
|
4019
|
-
columnName: ast.columnName
|
|
4098
|
+
columnName: (ast as ExpressionAst.ColumnNode<any, string>).columnName
|
|
4020
4099
|
}) as unknown as AstBackedExpression<
|
|
4021
4100
|
Expression.RuntimeOf<Value>,
|
|
4022
4101
|
Expression.DbTypeOf<Value>,
|
|
@@ -4049,7 +4128,7 @@ type BinaryPredicateExpression<
|
|
|
4049
4128
|
}
|
|
4050
4129
|
if (value !== null && typeof value === "object" && Expression.TypeId in value) {
|
|
4051
4130
|
const expression = value as unknown as Expression.Any
|
|
4052
|
-
const ast = (expression as
|
|
4131
|
+
const ast = (expression as Expression.Any & { readonly [ExpressionAst.TypeId]: ExpressionAst.Any })[ExpressionAst.TypeId]
|
|
4053
4132
|
if (ast.kind === "literal") {
|
|
4054
4133
|
const normalizedValue = normalizeMutationValue(ast.value)
|
|
4055
4134
|
return makeExpression({
|
|
@@ -4118,8 +4197,8 @@ type BinaryPredicateExpression<
|
|
|
4118
4197
|
: ">="
|
|
4119
4198
|
|
|
4120
4199
|
const targetSourceDetails = (table: MutationTargetLike | SchemaTableLike) => {
|
|
4121
|
-
const sourceName = (table as
|
|
4122
|
-
const sourceBaseName = (table as
|
|
4200
|
+
const sourceName = (table as TableLike)[Table.TypeId].name
|
|
4201
|
+
const sourceBaseName = (table as TableLike)[Table.TypeId].baseName
|
|
4123
4202
|
return {
|
|
4124
4203
|
sourceName,
|
|
4125
4204
|
sourceBaseName
|
|
@@ -4209,12 +4288,7 @@ type BinaryPredicateExpression<
|
|
|
4209
4288
|
|
|
4210
4289
|
const normalizeUnnestColumns = (columns: UnnestColumnsInput): Record<string, readonly Expression.Any[]> =>
|
|
4211
4290
|
Object.fromEntries(
|
|
4212
|
-
Object.entries(columns).map(([key, values]) =>
|
|
4213
|
-
if (!Array.isArray(values)) {
|
|
4214
|
-
throw new Error("unnest(...) expects every value to be an array")
|
|
4215
|
-
}
|
|
4216
|
-
return [key, values.map((value) => toDialectExpression(value))]
|
|
4217
|
-
})
|
|
4291
|
+
Object.entries(columns).map(([key, values]) => [key, values.map((value) => toDialectExpression(value))])
|
|
4218
4292
|
) as Record<string, readonly Expression.Any[]>
|
|
4219
4293
|
|
|
4220
4294
|
const normalizeMutationTargets = (
|
|
@@ -4260,13 +4334,7 @@ type BinaryPredicateExpression<
|
|
|
4260
4334
|
const getMutationColumn = (
|
|
4261
4335
|
columns: Record<string, unknown>,
|
|
4262
4336
|
columnName: string
|
|
4263
|
-
): Expression.Any =>
|
|
4264
|
-
const column = columns[columnName]
|
|
4265
|
-
if (column === undefined || column === null || typeof column !== "object" || !(Expression.TypeId in column)) {
|
|
4266
|
-
throw new Error("effect-qb: unknown mutation column")
|
|
4267
|
-
}
|
|
4268
|
-
return column as Expression.Any
|
|
4269
|
-
}
|
|
4337
|
+
): Expression.Any => columns[columnName] as Expression.Any
|
|
4270
4338
|
|
|
4271
4339
|
const buildMutationAssignments = <Target extends MutationTargetInput, Values>(
|
|
4272
4340
|
target: Target,
|
|
@@ -4282,7 +4350,7 @@ type BinaryPredicateExpression<
|
|
|
4282
4350
|
}
|
|
4283
4351
|
const valueMap = values as Record<string, Record<string, unknown> | undefined>
|
|
4284
4352
|
return targets.flatMap((table) => {
|
|
4285
|
-
const targetName = (table as
|
|
4353
|
+
const targetName = (table as TableLike)[Table.TypeId].name
|
|
4286
4354
|
const scopedValues = valueMap[targetName] ?? {}
|
|
4287
4355
|
const columns = table as unknown as Record<string, Expression.Any>
|
|
4288
4356
|
return Object.entries(scopedValues).map(([columnName, value]) => ({
|
|
@@ -4303,20 +4371,17 @@ type BinaryPredicateExpression<
|
|
|
4303
4371
|
} => {
|
|
4304
4372
|
const firstRow = rows[0]
|
|
4305
4373
|
const firstColumns = Object.keys(firstRow)
|
|
4306
|
-
if (firstColumns.length === 0) {
|
|
4307
|
-
throw new Error("values(...) rows must specify at least one column; use insert(target) for default-only inserts instead")
|
|
4308
|
-
}
|
|
4309
4374
|
const columns = firstColumns as [string, ...string[]]
|
|
4310
|
-
const
|
|
4311
|
-
const rowKeys = Object.keys(row)
|
|
4312
|
-
if (rowKeys.length !== columns.length || columns.some((column) => !(column in row))) {
|
|
4313
|
-
throw new Error("All values(...) rows must project the same columns in the same shape")
|
|
4314
|
-
}
|
|
4375
|
+
const normalizeRow = (row: InsertRowInput<Target>) => {
|
|
4315
4376
|
const assignments = buildMutationAssignments(target, row) as readonly QueryAst.AssignmentClause[]
|
|
4316
4377
|
return {
|
|
4317
4378
|
values: columns.map((columnName) => assignments.find((assignment) => assignment.columnName === columnName)!)
|
|
4318
4379
|
} satisfies QueryAst.InsertValuesRowClause
|
|
4319
|
-
}
|
|
4380
|
+
}
|
|
4381
|
+
const normalizedRows: readonly [QueryAst.InsertValuesRowClause, ...QueryAst.InsertValuesRowClause[]] = [
|
|
4382
|
+
normalizeRow(rows[0]),
|
|
4383
|
+
...rows.slice(1).map(normalizeRow)
|
|
4384
|
+
]
|
|
4320
4385
|
const required = normalizedRows.flatMap((row) =>
|
|
4321
4386
|
row.values.flatMap((entry) => Object.keys(entry.value[Expression.TypeId].dependencies))
|
|
4322
4387
|
)
|
|
@@ -4331,9 +4396,6 @@ type BinaryPredicateExpression<
|
|
|
4331
4396
|
selection: Record<string, Expression.Any>
|
|
4332
4397
|
): readonly [string, ...string[]] => {
|
|
4333
4398
|
const columns = Object.keys(selection)
|
|
4334
|
-
if (columns.length === 0) {
|
|
4335
|
-
throw new Error("insert(...).pipe(from(subquery)) requires at least one projected column")
|
|
4336
|
-
}
|
|
4337
4399
|
return columns as [string, ...string[]]
|
|
4338
4400
|
}
|
|
4339
4401
|
|
|
@@ -4348,27 +4410,11 @@ type BinaryPredicateExpression<
|
|
|
4348
4410
|
}[]
|
|
4349
4411
|
} => {
|
|
4350
4412
|
const entries = Object.entries(values)
|
|
4351
|
-
if (entries.length === 0) {
|
|
4352
|
-
throw new Error("unnest(...) requires at least one column array")
|
|
4353
|
-
}
|
|
4354
4413
|
const columns = entries.map(([columnName]) => columnName) as [string, ...string[]]
|
|
4355
|
-
const normalized = entries.map(([columnName, items]) => {
|
|
4356
|
-
|
|
4357
|
-
|
|
4358
|
-
|
|
4359
|
-
return {
|
|
4360
|
-
columnName,
|
|
4361
|
-
values: items
|
|
4362
|
-
}
|
|
4363
|
-
})
|
|
4364
|
-
const expectedLength = normalized[0]!.values.length
|
|
4365
|
-
if (normalized.some((entry) => entry.values.length !== expectedLength)) {
|
|
4366
|
-
throw new Error("unnest(...) expects every column array to have the same length")
|
|
4367
|
-
}
|
|
4368
|
-
const knownColumns = new Set(Object.keys(target[Table.TypeId].fields))
|
|
4369
|
-
if (columns.some((columnName) => !knownColumns.has(columnName))) {
|
|
4370
|
-
throw new Error("unnest(...) received a column that does not exist on the target table")
|
|
4371
|
-
}
|
|
4414
|
+
const normalized = entries.map(([columnName, items]) => ({
|
|
4415
|
+
columnName,
|
|
4416
|
+
values: items
|
|
4417
|
+
}))
|
|
4372
4418
|
return {
|
|
4373
4419
|
columns,
|
|
4374
4420
|
values: normalized
|
|
@@ -4380,10 +4426,6 @@ type BinaryPredicateExpression<
|
|
|
4380
4426
|
columnsInput: string | readonly string[]
|
|
4381
4427
|
): readonly [string, ...string[]] => {
|
|
4382
4428
|
const columns = normalizeColumnList(columnsInput) as readonly [string, ...string[]]
|
|
4383
|
-
const knownColumns = new Set(Object.keys(target[Table.TypeId].fields))
|
|
4384
|
-
if (columns.some((columnName) => !knownColumns.has(columnName))) {
|
|
4385
|
-
throw new Error("effect-qb: unknown conflict target column")
|
|
4386
|
-
}
|
|
4387
4429
|
return columns
|
|
4388
4430
|
}
|
|
4389
4431
|
|
|
@@ -4397,7 +4439,21 @@ type BinaryPredicateExpression<
|
|
|
4397
4439
|
columns: normalizeConflictColumns(target, input)
|
|
4398
4440
|
}
|
|
4399
4441
|
}
|
|
4400
|
-
|
|
4442
|
+
if (!Array.isArray(input) && "constraint" in input) {
|
|
4443
|
+
return {
|
|
4444
|
+
kind: "constraint",
|
|
4445
|
+
name: input.constraint
|
|
4446
|
+
}
|
|
4447
|
+
}
|
|
4448
|
+
const columnTarget = input as {
|
|
4449
|
+
readonly columns: string | readonly string[]
|
|
4450
|
+
readonly where?: PredicateInput
|
|
4451
|
+
}
|
|
4452
|
+
return {
|
|
4453
|
+
kind: "columns",
|
|
4454
|
+
columns: normalizeConflictColumns(target, columnTarget.columns),
|
|
4455
|
+
where: columnTarget.where === undefined ? undefined : toDialectExpression(columnTarget.where)
|
|
4456
|
+
}
|
|
4401
4457
|
}
|
|
4402
4458
|
|
|
4403
4459
|
const defaultIndexName = (
|
|
@@ -4448,14 +4504,91 @@ type ValidateTargetColumnInput<
|
|
|
4448
4504
|
Columns extends DdlColumnInput
|
|
4449
4505
|
> = ValidateTargetColumns<Target, NormalizeDdlColumns<Columns>> extends never ? never : Columns
|
|
4450
4506
|
|
|
4451
|
-
type
|
|
4452
|
-
readonly
|
|
4507
|
+
type SameColumnSet<
|
|
4508
|
+
Left extends readonly string[],
|
|
4509
|
+
Right extends readonly string[]
|
|
4510
|
+
> = string extends Left[number] | Right[number]
|
|
4511
|
+
? false
|
|
4512
|
+
: Exclude<Left[number], Right[number]> extends never
|
|
4513
|
+
? Exclude<Right[number], Left[number]> extends never
|
|
4514
|
+
? true
|
|
4515
|
+
: false
|
|
4516
|
+
: false
|
|
4517
|
+
|
|
4518
|
+
type ConflictArbitersOf<Target extends MutationTargetLike> =
|
|
4519
|
+
Target[typeof Table.TypeId]["conflictArbiters"][number]
|
|
4520
|
+
|
|
4521
|
+
type MatchingConflictArbiter<
|
|
4522
|
+
Target extends MutationTargetLike,
|
|
4523
|
+
Columns extends readonly string[],
|
|
4524
|
+
AllowPartial extends boolean
|
|
4525
|
+
> = ConflictArbitersOf<Target> extends infer Arbiter extends Table.ConflictArbiter
|
|
4526
|
+
? Arbiter extends Table.ConflictArbiter
|
|
4527
|
+
? SameColumnSet<Arbiter["columns"], Columns> extends true
|
|
4528
|
+
? Arbiter["scope"] extends "unconditional"
|
|
4529
|
+
? true
|
|
4530
|
+
: AllowPartial extends true ? true : never
|
|
4531
|
+
: never
|
|
4532
|
+
: never
|
|
4533
|
+
: never
|
|
4534
|
+
|
|
4535
|
+
type HasInlineConflictArbiter<
|
|
4536
|
+
Target extends MutationTargetLike,
|
|
4537
|
+
Columns extends readonly string[]
|
|
4538
|
+
> = Columns extends readonly [infer Column extends Extract<keyof Target[typeof Table.TypeId]["fields"], string>]
|
|
4539
|
+
? Target[typeof Table.TypeId]["fields"][Column] extends { readonly metadata: { readonly primaryKey: true } | { readonly unique: true } }
|
|
4540
|
+
? true
|
|
4541
|
+
: false
|
|
4542
|
+
: false
|
|
4543
|
+
|
|
4544
|
+
type HasConflictArbiter<
|
|
4545
|
+
Target extends MutationTargetLike,
|
|
4546
|
+
Columns extends readonly string[],
|
|
4547
|
+
AllowPartial extends boolean
|
|
4548
|
+
> = string extends Extract<keyof Target[typeof Table.TypeId]["fields"], string>
|
|
4549
|
+
? true
|
|
4550
|
+
: HasInlineConflictArbiter<Target, Columns> extends true
|
|
4551
|
+
? true
|
|
4552
|
+
: true extends MatchingConflictArbiter<Target, Columns, AllowPartial> ? true : false
|
|
4553
|
+
|
|
4554
|
+
type ConflictTargetArbiterError<
|
|
4555
|
+
Columns,
|
|
4556
|
+
AllowPartial extends boolean
|
|
4557
|
+
> = {
|
|
4558
|
+
readonly __effect_qb_error__: "effect-qb: conflict target columns must match a primary key, unique constraint, or unique index"
|
|
4559
|
+
readonly __effect_qb_conflict_columns__: Columns
|
|
4560
|
+
readonly __effect_qb_partial_target__: AllowPartial
|
|
4561
|
+
readonly __effect_qb_hint__: "Declare the target columns as primaryKey/unique, add a table-level Unique.make(...), or use a simple Pg.Index.uniqueIndex(...)"
|
|
4562
|
+
}
|
|
4563
|
+
|
|
4564
|
+
type ValidateConflictColumnInput<
|
|
4565
|
+
Target extends MutationTargetLike,
|
|
4566
|
+
Columns extends DdlColumnInput,
|
|
4567
|
+
AllowPartial extends boolean
|
|
4568
|
+
> = ValidateTargetColumnInput<Target, Columns> extends never
|
|
4569
|
+
? never
|
|
4570
|
+
: HasConflictArbiter<Target, NormalizeDdlColumns<Columns>, AllowPartial> extends true
|
|
4571
|
+
? Columns
|
|
4572
|
+
: ConflictTargetArbiterError<NormalizeDdlColumns<Columns>, AllowPartial>
|
|
4573
|
+
|
|
4574
|
+
type ConflictColumnPlanConstraint<
|
|
4575
|
+
Target extends MutationTargetLike,
|
|
4576
|
+
Columns extends DdlColumnInput,
|
|
4577
|
+
AllowPartial extends boolean
|
|
4578
|
+
> = ValidateTargetColumnInput<Target, Columns> extends never
|
|
4579
|
+
? never
|
|
4580
|
+
: HasConflictArbiter<Target, NormalizeDdlColumns<Columns>, AllowPartial> extends true
|
|
4581
|
+
? unknown
|
|
4582
|
+
: ConflictTargetArbiterError<NormalizeDdlColumns<Columns>, AllowPartial>
|
|
4583
|
+
|
|
4584
|
+
type CreateIndexOptions<Name extends string = string> = {
|
|
4585
|
+
readonly name?: NonEmptyStringInput<Name>
|
|
4453
4586
|
readonly unique?: boolean
|
|
4454
4587
|
readonly ifNotExists?: never
|
|
4455
4588
|
}
|
|
4456
4589
|
|
|
4457
|
-
type DropIndexOptions = {
|
|
4458
|
-
readonly name?:
|
|
4590
|
+
type DropIndexOptions<Name extends string = string> = {
|
|
4591
|
+
readonly name?: NonEmptyStringInput<Name>
|
|
4459
4592
|
readonly ifExists?: never
|
|
4460
4593
|
}
|
|
4461
4594
|
|
|
@@ -4559,7 +4692,7 @@ type ValuesRowsDialectInput<
|
|
|
4559
4692
|
BoolDb extends Expression.DbType.Any,
|
|
4560
4693
|
TimestampDb extends Expression.DbType.Any,
|
|
4561
4694
|
NullDb extends Expression.DbType.Any
|
|
4562
|
-
> = Exclude<ValuesRowsDialect<Rows, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb>, Dialect> extends never
|
|
4695
|
+
> = Exclude<ValuesRowsDialect<Rows, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb>, Dialect | "standard"> extends never
|
|
4563
4696
|
? unknown
|
|
4564
4697
|
: {
|
|
4565
4698
|
readonly __effect_qb_error__: "effect-qb: values rows cannot mix dialects"
|
|
@@ -4614,7 +4747,7 @@ type UnnestColumnsDialectInput<
|
|
|
4614
4747
|
BoolDb extends Expression.DbType.Any,
|
|
4615
4748
|
TimestampDb extends Expression.DbType.Any,
|
|
4616
4749
|
NullDb extends Expression.DbType.Any
|
|
4617
|
-
> = Exclude<UnnestColumnsDialect<Columns, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb>, Dialect> extends never
|
|
4750
|
+
> = Exclude<UnnestColumnsDialect<Columns, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb>, Dialect | "standard"> extends never
|
|
4618
4751
|
? unknown
|
|
4619
4752
|
: {
|
|
4620
4753
|
readonly __effect_qb_error__: "effect-qb: unnest columns cannot mix dialects"
|
|
@@ -4886,6 +5019,26 @@ type ConflictTargetInput<
|
|
|
4886
5019
|
readonly constraint?: string
|
|
4887
5020
|
}>)
|
|
4888
5021
|
|
|
5022
|
+
type ConflictConstraintNameConstraint<Target> =
|
|
5023
|
+
Target extends { readonly constraint: infer Constraint extends string }
|
|
5024
|
+
? { readonly constraint: NonEmptyStringInput<Constraint> }
|
|
5025
|
+
: unknown
|
|
5026
|
+
|
|
5027
|
+
type ConflictTargetHasPredicate<Target> =
|
|
5028
|
+
Target extends { readonly where: PredicateInput } ? true : false
|
|
5029
|
+
|
|
5030
|
+
type ConflictTargetPlanConstraint<
|
|
5031
|
+
Target extends MutationTargetLike,
|
|
5032
|
+
ConflictTarget
|
|
5033
|
+
> =
|
|
5034
|
+
ConflictTarget extends { readonly constraint: string }
|
|
5035
|
+
? unknown
|
|
5036
|
+
: ConflictTarget extends { readonly columns: infer Columns extends DdlColumnInput }
|
|
5037
|
+
? ConflictColumnPlanConstraint<Target, Columns, ConflictTargetHasPredicate<ConflictTarget>>
|
|
5038
|
+
: ConflictTarget extends DdlColumnInput
|
|
5039
|
+
? ConflictColumnPlanConstraint<Target, ConflictTarget, false>
|
|
5040
|
+
: unknown
|
|
5041
|
+
|
|
4889
5042
|
type ConflictActionInput<
|
|
4890
5043
|
Target extends MutationTargetLike,
|
|
4891
5044
|
Dialect extends string,
|
|
@@ -5032,7 +5185,7 @@ type MutationOrderLimitSupported<PlanValue extends QueryPlan<any, any, any, any,
|
|
|
5032
5185
|
type MutationTargetTupleDialectConstraint<
|
|
5033
5186
|
Targets extends MutationTargetTuple,
|
|
5034
5187
|
Dialect extends string
|
|
5035
|
-
> = Exclude<TableDialectOf<Targets[number]>, Dialect> extends never ? unknown : never
|
|
5188
|
+
> = Exclude<TableDialectOf<Targets[number]>, Dialect | "standard"> extends never ? unknown : never
|
|
5036
5189
|
|
|
5037
5190
|
type TableDialectConstraint<
|
|
5038
5191
|
Target extends TableLike,
|
|
@@ -5118,7 +5271,7 @@ type KnownIncompatibleMutationDialectFromValues<
|
|
|
5118
5271
|
BoolDb extends Expression.DbType.Any,
|
|
5119
5272
|
TimestampDb extends Expression.DbType.Any,
|
|
5120
5273
|
NullDb extends Expression.DbType.Any
|
|
5121
|
-
> = Exclude<KnownMutationDialectFromValues<Values, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb>, Dialect>
|
|
5274
|
+
> = Exclude<KnownMutationDialectFromValues<Values, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb>, Dialect | "standard">
|
|
5122
5275
|
|
|
5123
5276
|
type MutationValuesDialectConstraint<
|
|
5124
5277
|
Values,
|
|
@@ -5170,9 +5323,11 @@ type SourceDialectConstraint<
|
|
|
5170
5323
|
Dialect extends string
|
|
5171
5324
|
> = [SourceDialectOf<CurrentSource>] extends [never]
|
|
5172
5325
|
? unknown
|
|
5173
|
-
:
|
|
5174
|
-
?
|
|
5175
|
-
:
|
|
5326
|
+
: Exclude<SourceDialectOf<CurrentSource>, Dialect | "standard"> extends never
|
|
5327
|
+
? unknown
|
|
5328
|
+
: Dialect extends "standard"
|
|
5329
|
+
? unknown
|
|
5330
|
+
: never
|
|
5176
5331
|
|
|
5177
5332
|
type SourceRequirementConstraint<
|
|
5178
5333
|
PlanValue extends QueryPlan<any, any, any, any, any, any, any, any, any, any>,
|
|
@@ -5436,7 +5591,7 @@ type AsCurriedResult<
|
|
|
5436
5591
|
function as<
|
|
5437
5592
|
Alias extends string
|
|
5438
5593
|
>(
|
|
5439
|
-
alias: Alias
|
|
5594
|
+
alias: LiteralStringInput<Alias>
|
|
5440
5595
|
): <Value extends AsCurriedInput<Dialect>>(
|
|
5441
5596
|
value: Value
|
|
5442
5597
|
) => AsCurriedResult<Value, Alias, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb>
|
|
@@ -5445,7 +5600,7 @@ type AsCurriedResult<
|
|
|
5445
5600
|
Alias extends string
|
|
5446
5601
|
>(
|
|
5447
5602
|
value: Value,
|
|
5448
|
-
alias: Alias
|
|
5603
|
+
alias: LiteralStringInput<Alias>
|
|
5449
5604
|
): ProjectionAliasedExpression<DialectAsExpression<Value, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb>, Alias>
|
|
5450
5605
|
function as<
|
|
5451
5606
|
Rows extends ValuesRowsInput,
|
|
@@ -5456,7 +5611,7 @@ type AsCurriedResult<
|
|
|
5456
5611
|
ValuesOutputShape<Rows, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb>,
|
|
5457
5612
|
Dialect
|
|
5458
5613
|
>,
|
|
5459
|
-
alias: Alias
|
|
5614
|
+
alias: LiteralStringInput<Alias>
|
|
5460
5615
|
): ValuesSource<
|
|
5461
5616
|
Rows,
|
|
5462
5617
|
ValuesOutputShape<Rows, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb>,
|
|
@@ -5468,11 +5623,11 @@ type AsCurriedResult<
|
|
|
5468
5623
|
Alias extends string
|
|
5469
5624
|
>(
|
|
5470
5625
|
value: DerivedTableCompatiblePlan<PlanValue>,
|
|
5471
|
-
alias: Alias
|
|
5626
|
+
alias: LiteralStringInput<Alias>
|
|
5472
5627
|
): DerivedSource<PlanValue, Alias>
|
|
5473
5628
|
function as(valueOrAlias: unknown, alias?: string): unknown {
|
|
5474
5629
|
if (alias === undefined) {
|
|
5475
|
-
return (value: unknown) => as(value as any, valueOrAlias as
|
|
5630
|
+
return (value: unknown) => as(value as any, valueOrAlias as never)
|
|
5476
5631
|
}
|
|
5477
5632
|
const resolvedAlias = alias
|
|
5478
5633
|
const value = valueOrAlias
|
|
@@ -5512,7 +5667,7 @@ type AsCurriedResult<
|
|
|
5512
5667
|
function with_<
|
|
5513
5668
|
Alias extends string
|
|
5514
5669
|
>(
|
|
5515
|
-
alias: Alias
|
|
5670
|
+
alias: LiteralStringInput<Alias>
|
|
5516
5671
|
): <PlanValue extends QueryPlan<any, any, any, any, any, any, any, any, any, any>>(
|
|
5517
5672
|
value: MysqlCteCompatiblePlan<PlanValue>
|
|
5518
5673
|
) => import("../../internal/query.js").CteSource<PlanValue, Alias>
|
|
@@ -5521,11 +5676,11 @@ type AsCurriedResult<
|
|
|
5521
5676
|
Alias extends string
|
|
5522
5677
|
>(
|
|
5523
5678
|
value: MysqlCteCompatiblePlan<PlanValue>,
|
|
5524
|
-
alias: Alias
|
|
5679
|
+
alias: LiteralStringInput<Alias>
|
|
5525
5680
|
): import("../../internal/query.js").CteSource<PlanValue, Alias>
|
|
5526
5681
|
function with_(valueOrAlias: unknown, alias?: string): unknown {
|
|
5527
5682
|
if (alias === undefined) {
|
|
5528
|
-
return (value: unknown) => with_(value as any, valueOrAlias as
|
|
5683
|
+
return (value: unknown) => with_(value as any, valueOrAlias as never)
|
|
5529
5684
|
}
|
|
5530
5685
|
return makeCteSource(
|
|
5531
5686
|
valueOrAlias as CompletePlan<QueryPlan<any, any, any, any, any, any, any, any, any, any>>,
|
|
@@ -5536,7 +5691,7 @@ type AsCurriedResult<
|
|
|
5536
5691
|
function withRecursive_<
|
|
5537
5692
|
Alias extends string
|
|
5538
5693
|
>(
|
|
5539
|
-
alias: Alias
|
|
5694
|
+
alias: LiteralStringInput<Alias>
|
|
5540
5695
|
): <PlanValue extends QueryPlan<any, any, any, any, any, any, any, any, any, any>>(
|
|
5541
5696
|
value: MysqlCteCompatiblePlan<PlanValue>
|
|
5542
5697
|
) => import("../../internal/query.js").CteSource<PlanValue, Alias>
|
|
@@ -5545,11 +5700,11 @@ type AsCurriedResult<
|
|
|
5545
5700
|
Alias extends string
|
|
5546
5701
|
>(
|
|
5547
5702
|
value: MysqlCteCompatiblePlan<PlanValue>,
|
|
5548
|
-
alias: Alias
|
|
5703
|
+
alias: LiteralStringInput<Alias>
|
|
5549
5704
|
): import("../../internal/query.js").CteSource<PlanValue, Alias>
|
|
5550
5705
|
function withRecursive_(valueOrAlias: unknown, alias?: string): unknown {
|
|
5551
5706
|
if (alias === undefined) {
|
|
5552
|
-
return (value: unknown) => withRecursive_(value as any, valueOrAlias as
|
|
5707
|
+
return (value: unknown) => withRecursive_(value as any, valueOrAlias as never)
|
|
5553
5708
|
}
|
|
5554
5709
|
return makeCteSource(
|
|
5555
5710
|
valueOrAlias as CompletePlan<QueryPlan<any, any, any, any, any, any, any, any, any, any>>,
|
|
@@ -5561,7 +5716,7 @@ type AsCurriedResult<
|
|
|
5561
5716
|
function lateral<
|
|
5562
5717
|
Alias extends string
|
|
5563
5718
|
>(
|
|
5564
|
-
alias: Alias
|
|
5719
|
+
alias: LiteralStringInput<Alias>
|
|
5565
5720
|
): <PlanValue extends QueryPlan<any, any, any, any, any, any, any, any, any, any>>(
|
|
5566
5721
|
value: LateralSourceCompatiblePlan<PlanValue>
|
|
5567
5722
|
) => import("../../internal/query.js").LateralSource<PlanValue, Alias>
|
|
@@ -5570,11 +5725,11 @@ type AsCurriedResult<
|
|
|
5570
5725
|
Alias extends string
|
|
5571
5726
|
>(
|
|
5572
5727
|
value: LateralSourceCompatiblePlan<PlanValue>,
|
|
5573
|
-
alias: Alias
|
|
5728
|
+
alias: LiteralStringInput<Alias>
|
|
5574
5729
|
): import("../../internal/query.js").LateralSource<PlanValue, Alias>
|
|
5575
5730
|
function lateral(valueOrAlias: unknown, alias?: string): unknown {
|
|
5576
5731
|
if (alias === undefined) {
|
|
5577
|
-
return (value: unknown) => lateral(value as any, valueOrAlias as
|
|
5732
|
+
return (value: unknown) => lateral(value as any, valueOrAlias as never)
|
|
5578
5733
|
}
|
|
5579
5734
|
return makeLateralSource(
|
|
5580
5735
|
valueOrAlias as QueryPlan<any, any, any, any, any, any, any, any, any, any>,
|
|
@@ -5601,7 +5756,7 @@ type AsCurriedResult<
|
|
|
5601
5756
|
columns: Columns
|
|
5602
5757
|
& UnnestColumnsShapeInput<Columns>
|
|
5603
5758
|
& UnnestColumnsDialectInput<Columns, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb>,
|
|
5604
|
-
alias: Alias
|
|
5759
|
+
alias: LiteralStringInput<Alias>
|
|
5605
5760
|
) => UnnestSource<
|
|
5606
5761
|
UnnestOutputShape<Columns, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb>,
|
|
5607
5762
|
Alias,
|
|
@@ -5617,7 +5772,7 @@ type AsCurriedResult<
|
|
|
5617
5772
|
start: Start & NumericExpressionDialectInput<Start, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb>,
|
|
5618
5773
|
stop: Stop & NumericExpressionDialectInput<Stop, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb>,
|
|
5619
5774
|
step?: Step & (Step extends NumericExpressionInput ? NumericExpressionDialectInput<Step, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb> : unknown),
|
|
5620
|
-
alias?: Alias
|
|
5775
|
+
alias?: LiteralStringInput<Alias>
|
|
5621
5776
|
) => Dialect extends "postgres"
|
|
5622
5777
|
? TableFunctionSource<
|
|
5623
5778
|
GenerateSeriesOutputShape<Start, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb>,
|
|
@@ -5664,8 +5819,8 @@ type AsCurriedResult<
|
|
|
5664
5819
|
? SelectSelectionNonEmptyError<Selection>
|
|
5665
5820
|
: unknown
|
|
5666
5821
|
|
|
5667
|
-
export type SelectApi = <Selection extends SelectionShape>(
|
|
5668
|
-
selection: Selection & SelectionRootObjectConstraint<Selection> & SelectionNestedNonEmptyConstraint<Selection> & SelectSelectionNonEmptyConstraint<Selection>
|
|
5822
|
+
export type SelectApi = <const Selection extends SelectionShape>(
|
|
5823
|
+
selection: Selection & SelectionRootObjectConstraint<Selection> & SelectionNestedNonEmptyConstraint<Selection> & SelectSelectionNonEmptyConstraint<Selection> & SelectionProjectionAliasCollisionConstraint<Selection>
|
|
5669
5824
|
) => QueryPlan<
|
|
5670
5825
|
Selection,
|
|
5671
5826
|
ExtractRequired<Selection>,
|
|
@@ -6130,8 +6285,8 @@ type AsCurriedResult<
|
|
|
6130
6285
|
: unknown
|
|
6131
6286
|
|
|
6132
6287
|
type ReturningApi = Dialect extends "postgres"
|
|
6133
|
-
? <Selection extends SelectionShape>(
|
|
6134
|
-
selection: Selection & SelectionRootObjectConstraint<Selection> & SelectionNestedNonEmptyConstraint<Selection> & ReturningSelectionNonEmptyConstraint<Selection>
|
|
6288
|
+
? <const Selection extends SelectionShape>(
|
|
6289
|
+
selection: Selection & SelectionRootObjectConstraint<Selection> & SelectionNestedNonEmptyConstraint<Selection> & ReturningSelectionNonEmptyConstraint<Selection> & SelectionProjectionAliasCollisionConstraint<Selection>
|
|
6135
6290
|
) =>
|
|
6136
6291
|
<PlanValue extends QueryPlan<any, any, any, any, any, any, any, any, any, any>>(
|
|
6137
6292
|
plan: PlanValue & RequireMutationStatement<PlanValue>
|
|
@@ -6200,13 +6355,13 @@ type AsCurriedResult<
|
|
|
6200
6355
|
const Columns extends DdlColumnInput,
|
|
6201
6356
|
UpdateValues extends MutationInputOf<Table.UpdateOf<Target>> | undefined = MutationInputOf<Table.UpdateOf<Target>> | undefined,
|
|
6202
6357
|
Options extends ConflictActionInput<Target, Dialect, UpdateValues> = ConflictActionInput<Target, Dialect, UpdateValues>,
|
|
6203
|
-
ConflictTarget extends ConflictTargetInput<Target, Dialect, Columns> = ConflictTargetInput<Target, Dialect, Columns>
|
|
6358
|
+
const ConflictTarget extends ConflictTargetInput<Target, Dialect, Columns> = ConflictTargetInput<Target, Dialect, Columns>
|
|
6204
6359
|
>(
|
|
6205
|
-
target: ConflictTarget
|
|
6360
|
+
target: ConflictTarget & ConflictConstraintNameConstraint<ConflictTarget>,
|
|
6206
6361
|
options?: Options & ConflictActionUpdateNonEmptyConstraint<Options>
|
|
6207
|
-
|
|
6362
|
+
) =>
|
|
6208
6363
|
<PlanValue extends QueryPlan<any, any, any, any, any, any, any, any, any, any>>(
|
|
6209
|
-
plan: PlanValue & RequireInsertStatement<PlanValue>
|
|
6364
|
+
plan: PlanValue & RequireInsertStatement<PlanValue> & ConflictTargetPlanConstraint<MutationTargetOfPlan<PlanValue>, ConflictTarget>
|
|
6210
6365
|
) => QueryPlan<
|
|
6211
6366
|
SelectionOfPlan<PlanValue>,
|
|
6212
6367
|
Exclude<RequiredOfPlan<PlanValue> | ConflictRequired<UpdateValues, Options, ConflictTarget>, AvailableNames<AvailableOfPlan<PlanValue>>>,
|
|
@@ -6270,7 +6425,7 @@ type AsCurriedResult<
|
|
|
6270
6425
|
>(
|
|
6271
6426
|
target: Target & TableDialectConstraint<Target, Dialect>,
|
|
6272
6427
|
values: Values & MutationValuesDialectConstraint<Values, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb>,
|
|
6273
|
-
conflictColumns:
|
|
6428
|
+
conflictColumns: ValidateConflictColumnInput<Target, Columns, false>,
|
|
6274
6429
|
updateValues?: UpdateValues & UpdateValuesNonEmptyConstraint<Exclude<UpdateValues, undefined>> & MutationValuesDialectConstraint<Exclude<UpdateValues, undefined>, Dialect, TextDb, NumericDb, BoolDb, TimestampDb, NullDb>
|
|
6275
6430
|
) => QueryPlan<
|
|
6276
6431
|
{},
|
|
@@ -6578,7 +6733,7 @@ type AsCurriedResult<
|
|
|
6578
6733
|
"rollback"
|
|
6579
6734
|
>
|
|
6580
6735
|
|
|
6581
|
-
type SavepointApi = <Name extends string>(name: Name) => QueryPlan<
|
|
6736
|
+
type SavepointApi = <Name extends string>(name: NonEmptyStringInput<Name>) => QueryPlan<
|
|
6582
6737
|
{},
|
|
6583
6738
|
never,
|
|
6584
6739
|
{},
|
|
@@ -6591,7 +6746,7 @@ type AsCurriedResult<
|
|
|
6591
6746
|
"savepoint"
|
|
6592
6747
|
>
|
|
6593
6748
|
|
|
6594
|
-
type RollbackToApi = <Name extends string>(name: Name) => QueryPlan<
|
|
6749
|
+
type RollbackToApi = <Name extends string>(name: NonEmptyStringInput<Name>) => QueryPlan<
|
|
6595
6750
|
{},
|
|
6596
6751
|
never,
|
|
6597
6752
|
{},
|
|
@@ -6604,7 +6759,7 @@ type AsCurriedResult<
|
|
|
6604
6759
|
"rollbackTo"
|
|
6605
6760
|
>
|
|
6606
6761
|
|
|
6607
|
-
type ReleaseSavepointApi = <Name extends string>(name: Name) => QueryPlan<
|
|
6762
|
+
type ReleaseSavepointApi = <Name extends string>(name: NonEmptyStringInput<Name>) => QueryPlan<
|
|
6608
6763
|
{},
|
|
6609
6764
|
never,
|
|
6610
6765
|
{},
|
|
@@ -6649,10 +6804,10 @@ type AsCurriedResult<
|
|
|
6649
6804
|
"dropTable"
|
|
6650
6805
|
>
|
|
6651
6806
|
|
|
6652
|
-
type CreateIndexApi = <Target extends SchemaTableLike, const Columns extends DdlColumnInput>(
|
|
6807
|
+
type CreateIndexApi = <Target extends SchemaTableLike, const Columns extends DdlColumnInput, Name extends string = string>(
|
|
6653
6808
|
target: Target & TableDialectConstraint<Target, Dialect>,
|
|
6654
6809
|
columns: Columns & ValidateDdlColumnInput<Target, Columns>,
|
|
6655
|
-
options?: CreateIndexOptions
|
|
6810
|
+
options?: CreateIndexOptions<Name>
|
|
6656
6811
|
) => QueryPlan<
|
|
6657
6812
|
{},
|
|
6658
6813
|
never,
|
|
@@ -6666,10 +6821,10 @@ type AsCurriedResult<
|
|
|
6666
6821
|
"createIndex"
|
|
6667
6822
|
>
|
|
6668
6823
|
|
|
6669
|
-
type DropIndexApi = <Target extends SchemaTableLike, const Columns extends DdlColumnInput>(
|
|
6824
|
+
type DropIndexApi = <Target extends SchemaTableLike, const Columns extends DdlColumnInput, Name extends string = string>(
|
|
6670
6825
|
target: Target & TableDialectConstraint<Target, Dialect>,
|
|
6671
6826
|
columns: Columns & ValidateDdlColumnInput<Target, Columns>,
|
|
6672
|
-
options?: DropIndexOptions
|
|
6827
|
+
options?: DropIndexOptions<Name>
|
|
6673
6828
|
) => QueryPlan<
|
|
6674
6829
|
{},
|
|
6675
6830
|
never,
|