Skip to main content

excluded

Function excluded 

Source
pub const fn excluded<C>(column: C) -> Excluded<C>
Expand description

Reference a column’s value from the proposed insert row (EXCLUDED).

Used in ON CONFLICT DO UPDATE SET to reference the value that would have been inserted.

§Example

db.insert(simple)
    .values([InsertSimple::new("test").with_id(1)])
    .on_conflict(simple.id)
    .do_update(UpdateSimple::default().with_name(excluded(simple.name)));
// Generates: ... ON CONFLICT ("id") DO UPDATE SET "name" = EXCLUDED."name"