method Db.open
Opens a database: postgres://… (libpq URI; ?schema=name selects/creates the schema, postgres: alone uses OXL_PG_DSN),
sqlite:<path>, sqlite::memory: or builtin://<name> (the built-in replicated tables: SQLite per shard replica, Raft
carries row changesets, D-4380; one shard is the file <name>.db in the data directory, --data-dir / OXL_DATA_DIR, default
./data; builtin://<name>?shards=N has N shards and @shard(by: .field) tables are routed by hash; atomic/transaction stay
inside one shard, else CrossShardTx). A file is opened in WAL mode with a 5 s busy timeout.
Example:
use std.orm { Db }
fn main() io, db {
let db = Db.open("sqlite::memory:")!
print("opened")
db.close()
}Вывод
opened
pub(api) static fn open(url: str) -> Db | DbError dbС версии. 1.0.0-beta
Параметры
| Имя | Тип |
|---|---|
url | str |
Возвращает
Ошибки
DbError@error
Эффекты
db
Определено в: std/orm/orm.oxl:287