Skip to main content

increment

Function increment 

Source
pub fn increment<T>() -> Assignment<T>
where T: Numeric,
Expand description

Increment a numeric field by one.

The Numeric bound encodes the 1 literal in a value variant matching the field type, so stmt::increment() works on every supported numeric column (i8โ€“i64, u8โ€“u64, f32, f64) and on user newtypes that implement Numeric.

Atomic against the existing column value on every backend, same as add.

ยงExamples

โ“˜
user.update()
    .login_count(stmt::increment())
    .exec(&mut db)
    .await?;