data Table
A table of a database, db.User for a @table type (§12.8); from u in db.User where … is compiled to SQL (§5.9).
Example:
use std.orm { Db, DbError }
@table("notes")
data Note {
@pk id: i64
text: str
}
fn main() -> () | DbError io, db {
let db = Db.open("sqlite::memory:")?
db.insert(Note{ id: 1, text: "hello" })
db.insert(Note{ id: 2, text: "world" })
for text in from n in db.Note where n.id > 1 select n.text {
print(text)
}
}Output
world
@derive(Copy)
pub(api) data Table<T>Since. 1.0.0-beta
Fields
pub(api) db: Db | The database the table belongs to. |
Defined in: std/core/types.oxl:254