Skip to content

Commit 634c6a2

Browse files
authored
An alternate implementation of excluded conflict resolution (#100)
1 parent 852d4c8 commit 634c6a2

File tree

8 files changed

+343
-44
lines changed

8 files changed

+343
-44
lines changed

Sources/StructuredQueriesCore/Documentation.docc/Extensions/Update.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,4 @@
1414

1515
- ``UpdateOf``
1616
- ``Updates``
17-
- ``UpdatesOf``
1817
- ``ConflictResolution``

Sources/StructuredQueriesCore/Internal/Deprecations.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ extension Table {
4545
public static func insert(
4646
or conflictResolution: ConflictResolution? = nil,
4747
_ row: Self,
48-
onConflict doUpdate: ((inout Updates<Self, Excluded>) -> Void)? = nil
48+
onConflict doUpdate: ((inout Updates<Self>) -> Void)? = nil
4949
) -> InsertOf<Self> {
5050
insert(or: conflictResolution, [row], onConflict: doUpdate)
5151
}
@@ -56,7 +56,7 @@ extension Table {
5656
public static func insert(
5757
or conflictResolution: ConflictResolution? = nil,
5858
_ rows: [Self],
59-
onConflict doUpdate: ((inout Updates<Self, Excluded>) -> Void)? = nil
59+
onConflict doUpdate: ((inout Updates<Self>) -> Void)? = nil
6060
) -> InsertOf<Self> {
6161
insert(or: conflictResolution, values: { rows }, onConflict: doUpdate)
6262
}
@@ -66,7 +66,7 @@ extension Table {
6666
or conflictResolution: ConflictResolution? = nil,
6767
_ columns: (TableColumns) -> TableColumns = { $0 },
6868
@InsertValuesBuilder<Self> values: () -> [Self],
69-
onConflict updates: ((inout Updates<Self, Excluded>) -> Void)?
69+
onConflict updates: ((inout Updates<Self>) -> Void)?
7070
) -> InsertOf<Self> {
7171
insert(or: conflictResolution, columns, values: values, onConflictDoUpdate: updates)
7272
}
@@ -77,7 +77,7 @@ extension Table {
7777
_ columns: (TableColumns) -> (TableColumn<Self, V1>, repeat TableColumn<Self, each V2>),
7878
@InsertValuesBuilder<(V1.QueryOutput, repeat (each V2).QueryOutput)>
7979
values: () -> [(V1.QueryOutput, repeat (each V2).QueryOutput)],
80-
onConflict updates: ((inout Updates<Self, Excluded>) -> Void)?
80+
onConflict updates: ((inout Updates<Self>) -> Void)?
8181
) -> InsertOf<Self> {
8282
insert(or: conflictResolution, columns, values: values, onConflictDoUpdate: updates)
8383
}
@@ -89,7 +89,7 @@ extension Table {
8989
or conflictResolution: ConflictResolution? = nil,
9090
_ columns: (TableColumns) -> (TableColumn<Self, V1>, repeat TableColumn<Self, each V2>),
9191
select selection: () -> Select<(V1, repeat each V2), From, Joins>,
92-
onConflict updates: ((inout Updates<Self, Excluded>) -> Void)?
92+
onConflict updates: ((inout Updates<Self>) -> Void)?
9393
) -> InsertOf<Self> {
9494
insert(or: conflictResolution, columns, select: selection, onConflictDoUpdate: updates)
9595
}
@@ -102,7 +102,7 @@ extension PrimaryKeyedTable {
102102
public static func insert(
103103
or conflictResolution: ConflictResolution? = nil,
104104
_ row: Draft,
105-
onConflict updates: ((inout Updates<Self, Excluded>) -> Void)? = nil
105+
onConflict updates: ((inout Updates<Self>) -> Void)? = nil
106106
) -> InsertOf<Self> {
107107
insert(or: conflictResolution, values: { row }, onConflictDoUpdate: updates)
108108
}
@@ -113,7 +113,7 @@ extension PrimaryKeyedTable {
113113
public static func insert(
114114
or conflictResolution: ConflictResolution? = nil,
115115
_ rows: [Draft],
116-
onConflict updates: ((inout Updates<Self, Excluded>) -> Void)? = nil
116+
onConflict updates: ((inout Updates<Self>) -> Void)? = nil
117117
) -> InsertOf<Self> {
118118
insert(or: conflictResolution, values: { rows }, onConflictDoUpdate: updates)
119119
}

0 commit comments

Comments
 (0)