OxL Reference

method Table.all

Every row of the table.

Example:

oxl✓ checked in CI
use std.orm { Db }

@table("items")
data Item {
  @pk id: i64
  name: str
  price: i64
}

fn main() io, db {
  let db = Db.open("sqlite::memory:")!
  db.Item.insert(Item{ id: 1, name: "tea", price: 3 })
  db.Item.insert(Item{ id: 2, name: "cake", price: 9 })
  print("{db.Item.all().len()}")
  db.close()
}
Output
2
pub(api) fn all() -> List<T>  db

Complexity. O(rows).

Since. 1.0.0-beta

Returns

List<T>

Effects

db

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

See also