method Db.lastInsertId
Row id of the last insert (the key an @auto row got).
Example:
use std.orm { Db }
@table("items")
data Item { @pk @auto id: i64; name: str }
fn main() io, db {
let db = Db.open("sqlite::memory:")!
db.insert(Item{ id: 0, name: "a" })
print("{db.lastInsertId()}")
}Output
1
pub(api) fn lastInsertId() -> i64 dbSince. 1.0.0-beta
Returns
i64
Effects
db
Defined in: std/orm/orm.oxl:599