Let the user choose between the two possible update strategies for upsert

This commit is contained in:
Gwendal Roué committed 2026-02-15 13:40:05 +01:00
1 parent 7f9d1503a0
commit 7b01c9b72b
9 files changed
+717 -187

No files matched your search

@@ -1872,6 +1872,18 @@ public struct ColumnAssignment {
}
}
/// A strategy for updating database rows in case of upsert conflict.
public struct UpsertUpdateStrategy: OptionSet, Sendable {
public let rawValue: Int
public init(rawValue: Int) { self.rawValue = rawValue }
/// Only the specified columns are updated in the existing row.
public static let noColumnUnlessSpecified = Self([])
/// All columns are updated in the existing row, unless specified otherwise.
public static let allColumns = Self(rawValue: 1 << 0)
}
extension ColumnExpression {
/// Returns an assignment of this column to an SQL expression.
///