data Db
Handle of an open database (std.orm, §12.8): Db.open("sqlite:shop.db"). Methods: std/orm/orm.oxl.
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" })
print("{db.Note.count()}")
}Вывод
1
@derive(Copy)
pub(api) data DbПотокобезопасность. a handle that may be shared by tasks; transactions (`atomic`) belong to one task.
С версии. 1.0.0-beta
Поля
pub(api) h: i64 | Handle of the connection in the runtime. |
Определено в: std/core/types.oxl:225