method Db.count
Number of rows of the table: db.count(User).
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" })
db.insert(Item{ id: 0, name: "b" })
print("{db.count(Item)}")
}Output
2
pub(api) fn count<T>() -> i64 dbSince. 1.0.0-beta
Returns
i64
Effects
db
Defined in: std/orm/orm.oxl:538