OxL Reference

method Db.all

All rows of the table: db.all(User).

Example:

oxl✓ checked in CI
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.all(Item).len()}")
}
Output
2
pub(api) fn all<T>() -> List<T>  db

Since. 1.0.0-beta

Returns

List<T>

Effects

db

Defined in: std/orm/orm.oxl:563

See also