pub enum ConflictTarget {
PrimaryKey,
Columns(&'static [&'static str]),
}Expand description
Conflict target for an upsert. Defaults to the model’s primary key
(matching the previous PK-only behavior). Columns lets callers
upsert on an arbitrary unique tuple — most commonly a natural key
that’s distinct from the PK (e.g. (owner_id, provider) on a
per-owner-and-provider settings row, or (pairing_id, slot) on a
per-slot envelope).
The named columns MUST correspond to a UNIQUE constraint or
UNIQUE index on the target table — the database engine enforces
this and will surface a clear error if not. The upsert builder
additionally requires the input to carry a value for every column
in the target tuple, so the conflict probe (SELECT … FOR UPDATE)
has something to filter on.
Composite-constraint-by-name (ON CONFLICT ON CONSTRAINT my_unique_idx_v2) is not yet exposed; pass the matching column
tuple via Self::Columns instead.
Variants§
PrimaryKey
The model’s @id primary key. Default.
Columns(&'static [&'static str])
A caller-supplied tuple of columns forming a unique key on the target table.
Implementations§
Trait Implementations§
Source§impl Clone for ConflictTarget
impl Clone for ConflictTarget
Source§fn clone(&self) -> ConflictTarget
fn clone(&self) -> ConflictTarget
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for ConflictTarget
Source§impl Debug for ConflictTarget
impl Debug for ConflictTarget
Source§impl Default for ConflictTarget
impl Default for ConflictTarget
impl Eq for ConflictTarget
Source§impl PartialEq for ConflictTarget
impl PartialEq for ConflictTarget
Source§fn eq(&self, other: &ConflictTarget) -> bool
fn eq(&self, other: &ConflictTarget) -> bool
self and other values to be equal, and is used by ==.