@@ -54,7 +54,7 @@ extension Table {
5454 or conflictResolution: ConflictResolution ? = nil ,
5555 _ columns: ( TableColumns ) -> TableColumns = { $0 } ,
5656 @InsertValuesBuilder < Self > values: ( ) -> [ Self ] ,
57- onConflictDoUpdate updates: ( ( inout Upsert < Self > ) -> Void ) ? = nil ,
57+ onConflictDoUpdate updates: ( ( inout Updates < Self > ) -> Void ) ? = nil ,
5858 @QueryFragmentBuilder < Bool >
5959 where updateFilter: ( TableColumns ) -> [ QueryFragment ] = { _ in [ ] }
6060 ) -> InsertOf < Self > {
@@ -89,7 +89,7 @@ extension Table {
8989 ) ,
9090 @QueryFragmentBuilder < Bool >
9191 where targetFilter: ( TableColumns ) -> [ QueryFragment ] = { _ in [ ] } ,
92- doUpdate updates: ( inout Upsert < Self > ) -> Void = { _ in } ,
92+ doUpdate updates: ( inout Updates < Self > ) -> Void = { _ in } ,
9393 @QueryFragmentBuilder < Bool >
9494 where updateFilter: ( TableColumns ) -> [ QueryFragment ] = { _ in [ ] }
9595 ) -> InsertOf < Self > {
@@ -111,7 +111,7 @@ extension Table {
111111 onConflict conflictTargets: ( TableColumns ) -> ( repeat TableColumn < Self , each ConflictTarget > ) ? ,
112112 @QueryFragmentBuilder < Bool >
113113 where targetFilter: ( TableColumns ) -> [ QueryFragment ] = { _ in [ ] } ,
114- doUpdate updates: ( ( inout Upsert < Self > ) -> Void ) ? ,
114+ doUpdate updates: ( ( inout Updates < Self > ) -> Void ) ? ,
115115 @QueryFragmentBuilder < Bool >
116116 where updateFilter: ( TableColumns ) -> [ QueryFragment ] = { _ in [ ] }
117117 ) -> InsertOf < Self > {
@@ -197,7 +197,7 @@ extension Table {
197197 _ columns: ( TableColumns ) -> ( TableColumn < Self , V1 > , repeat TableColumn < Self , each V2 > ) ,
198198 @InsertValuesBuilder < ( V1 . QueryOutput , repeat ( each V2 ) . QueryOutput) >
199199 values: ( ) -> [ ( V1 . QueryOutput , repeat ( each V2 ) . QueryOutput) ] ,
200- onConflictDoUpdate updates: ( ( inout Upsert < Self > ) -> Void ) ? = nil ,
200+ onConflictDoUpdate updates: ( ( inout Updates < Self > ) -> Void ) ? = nil ,
201201 @QueryFragmentBuilder < Bool >
202202 where updateFilter: ( TableColumns ) -> [ QueryFragment ] = { _ in [ ] }
203203 ) -> InsertOf < Self > {
@@ -234,7 +234,7 @@ extension Table {
234234 ) ,
235235 @QueryFragmentBuilder < Bool >
236236 where targetFilter: ( TableColumns ) -> [ QueryFragment ] = { _ in [ ] } ,
237- doUpdate updates: ( inout Upsert < Self > ) -> Void = { _ in } ,
237+ doUpdate updates: ( inout Updates < Self > ) -> Void = { _ in } ,
238238 @QueryFragmentBuilder < Bool >
239239 where updateFilter: ( TableColumns ) -> [ QueryFragment ] = { _ in [ ] }
240240 ) -> InsertOf < Self > {
@@ -259,7 +259,7 @@ extension Table {
259259 onConflict conflictTargets: ( TableColumns ) -> ( repeat TableColumn < Self , each ConflictTarget > ) ? ,
260260 @QueryFragmentBuilder < Bool >
261261 where targetFilter: ( TableColumns ) -> [ QueryFragment ] = { _ in [ ] } ,
262- doUpdate updates: ( ( inout Upsert < Self > ) -> Void ) ? ,
262+ doUpdate updates: ( ( inout Updates < Self > ) -> Void ) ? ,
263263 @QueryFragmentBuilder < Bool >
264264 where updateFilter: ( TableColumns ) -> [ QueryFragment ] = { _ in [ ] }
265265 ) -> InsertOf < Self > {
@@ -306,7 +306,7 @@ extension Table {
306306 or conflictResolution: ConflictResolution ? = nil ,
307307 _ columns: ( TableColumns ) -> ( TableColumn < Self , V1 > , repeat TableColumn < Self , each V2 > ) ,
308308 select selection: ( ) -> some PartialSelectStatement < ( V1 , repeat each V2 ) > ,
309- onConflictDoUpdate updates: ( ( inout Upsert < Self > ) -> Void ) ? = nil ,
309+ onConflictDoUpdate updates: ( ( inout Updates < Self > ) -> Void ) ? = nil ,
310310 @QueryFragmentBuilder < Bool >
311311 where updateFilter: ( TableColumns ) -> [ QueryFragment ] = { _ in [ ] }
312312 ) -> InsertOf < Self > {
@@ -350,7 +350,7 @@ extension Table {
350350 ) ,
351351 @QueryFragmentBuilder < Bool >
352352 where targetFilter: ( TableColumns ) -> [ QueryFragment ] = { _ in [ ] } ,
353- doUpdate updates: ( inout Upsert < Self > ) -> Void = { _ in } ,
353+ doUpdate updates: ( inout Updates < Self > ) -> Void = { _ in } ,
354354 @QueryFragmentBuilder < Bool >
355355 where updateFilter: ( TableColumns ) -> [ QueryFragment ] = { _ in [ ] }
356356 ) -> InsertOf < Self > {
@@ -377,7 +377,7 @@ extension Table {
377377 onConflict conflictTargets: ( TableColumns ) -> ( repeat TableColumn < Self , each ConflictTarget > ) ? ,
378378 @QueryFragmentBuilder < Bool >
379379 where targetFilter: ( TableColumns ) -> [ QueryFragment ] = { _ in [ ] } ,
380- doUpdate updates: ( ( inout Upsert < Self > ) -> Void ) ? ,
380+ doUpdate updates: ( ( inout Updates < Self > ) -> Void ) ? ,
381381 @QueryFragmentBuilder < Bool >
382382 where updateFilter: ( TableColumns ) -> [ QueryFragment ] = { _ in [ ] }
383383 ) -> InsertOf < Self > {
@@ -428,7 +428,7 @@ extension Table {
428428 onConflict conflictTargets: ( TableColumns ) -> ( repeat TableColumn < Self , each ConflictTarget > ) ? ,
429429 @QueryFragmentBuilder < Bool >
430430 where targetFilter: ( TableColumns ) -> [ QueryFragment ] = { _ in [ ] } ,
431- doUpdate updates: ( ( inout Upsert < Self > ) -> Void ) ? ,
431+ doUpdate updates: ( ( inout Updates < Self > ) -> Void ) ? ,
432432 @QueryFragmentBuilder < Bool >
433433 where updateFilter: ( TableColumns ) -> [ QueryFragment ] = { _ in [ ] }
434434 ) -> InsertOf < Self > {
@@ -444,7 +444,7 @@ extension Table {
444444 conflictTargetColumnNames: conflictTargetColumnNames,
445445 conflictTargetFilter: targetFilter ( Self . columns) ,
446446 values: values,
447- updates: updates. map { Upsert ( $0) } ,
447+ updates: updates. map { Updates ( $0) } ,
448448 updateFilter: updateFilter ( Self . columns) ,
449449 returning: [ ]
450450 )
@@ -468,7 +468,7 @@ extension PrimaryKeyedTable {
468468 or conflictResolution: ConflictResolution ? = nil ,
469469 _ columns: ( Draft . TableColumns ) -> Draft . TableColumns = { $0 } ,
470470 @InsertValuesBuilder < Draft > values: ( ) -> [ Draft ] ,
471- onConflictDoUpdate updates: ( ( inout Upsert < Self > ) -> Void ) ? = nil ,
471+ onConflictDoUpdate updates: ( ( inout Updates < Self > ) -> Void ) ? = nil ,
472472 @QueryFragmentBuilder < Bool >
473473 where updateFilter: ( TableColumns ) -> [ QueryFragment ] = { _ in [ ] }
474474 ) -> InsertOf < Self > {
@@ -504,7 +504,7 @@ extension PrimaryKeyedTable {
504504 ) ,
505505 @QueryFragmentBuilder < Bool >
506506 where targetFilter: ( TableColumns ) -> [ QueryFragment ] = { _ in [ ] } ,
507- doUpdate updates: ( inout Upsert < Self > ) -> Void = { _ in } ,
507+ doUpdate updates: ( inout Updates < Self > ) -> Void = { _ in } ,
508508 @QueryFragmentBuilder < Bool >
509509 where updateFilter: ( TableColumns ) -> [ QueryFragment ] = { _ in [ ] }
510510 ) -> InsertOf < Self > {
@@ -545,7 +545,7 @@ extension PrimaryKeyedTable {
545545 onConflict: { $0. primaryKey } ,
546546 doUpdate: { updates in
547547 for column in Draft . TableColumns. allColumns where column. name != columns. primaryKey. name {
548- updates. updates . set ( column, #""excluded". \#( quote: column. name) "# )
548+ updates. set ( column, #""excluded". \#( quote: column. name) "# )
549549 }
550550 }
551551 )
@@ -557,7 +557,7 @@ extension PrimaryKeyedTable {
557557 onConflict conflictTargets: ( TableColumns ) -> ( repeat TableColumn < Self , each ConflictTarget > ) ? ,
558558 @QueryFragmentBuilder < Bool >
559559 where targetFilter: ( TableColumns ) -> [ QueryFragment ] = { _ in [ ] } ,
560- doUpdate updates: ( ( inout Upsert < Self > ) -> Void ) ? ,
560+ doUpdate updates: ( ( inout Updates < Self > ) -> Void ) ? ,
561561 @QueryFragmentBuilder < Bool >
562562 where updateFilter: ( TableColumns ) -> [ QueryFragment ] = { _ in [ ] }
563563 ) -> InsertOf < Self > {
@@ -590,49 +590,6 @@ private enum InsertValues {
590590 case select( QueryFragment )
591591}
592592
593- @dynamicMemberLookup
594- public struct Upsert < Base: Table > : QueryExpression {
595- public typealias QueryValue = Never
596-
597- public struct Excluded : AliasName {
598- public static var aliasName : String {
599- " excluded "
600- }
601- }
602-
603- init ( _ body: ( inout Self ) -> Void ) {
604- body ( & self )
605- }
606-
607- fileprivate var updates = Updates < Base > ( )
608-
609- public var excluded : TableAlias < Base , Excluded > . TableColumns {
610- Base . as ( Excluded . self) . columns
611- }
612-
613- public subscript< Member> ( dynamicMember keyPath: KeyPath < Updates < Base > , Member > ) -> Member {
614- updates [ keyPath: keyPath]
615- }
616-
617- public subscript< Member> (
618- dynamicMember keyPath: WritableKeyPath < Updates < Base > , Member >
619- ) -> Member {
620- get { updates [ keyPath: keyPath] }
621- set { updates [ keyPath: keyPath] = newValue }
622- }
623-
624- public subscript< Value> (
625- dynamicMember keyPath: KeyPath < Base . TableColumns , TableColumn < Base , Value > >
626- ) -> any QueryExpression < Value > {
627- get { updates [ dynamicMember: keyPath] }
628- set { updates [ dynamicMember: keyPath] = newValue }
629- }
630-
631- public var queryFragment : QueryFragment {
632- updates. queryFragment
633- }
634- }
635-
636593/// An `INSERT` statement.
637594///
638595/// This type of statement is returned from the
@@ -646,7 +603,7 @@ public struct Insert<Into: Table, Returning> {
646603 var conflictTargetColumnNames : [ String ]
647604 var conflictTargetFilter : [ QueryFragment ]
648605 fileprivate var values : InsertValues
649- var updates : Upsert < Into > ?
606+ var updates : Updates < Into > ?
650607 var updateFilter : [ QueryFragment ]
651608 var returning : [ QueryFragment ]
652609
@@ -656,7 +613,7 @@ public struct Insert<Into: Table, Returning> {
656613 conflictTargetColumnNames: [ String ] ,
657614 conflictTargetFilter: [ QueryFragment ] ,
658615 values: InsertValues ,
659- updates: Upsert < Into > ? ,
616+ updates: Updates < Into > ? ,
660617 updateFilter: [ QueryFragment ] ,
661618 returning: [ QueryFragment ]
662619 ) {
0 commit comments