data KvTx
The view of the store inside Kv.txn.
Example:
use std.kv { Kv }
fn main() io, db {
let kv = Kv.open("docs-kvtx")!
kv.put("balance", b"10")!
let r = kv.txn(tx => {
let old = tx.get("balance") ?? b""
tx.put("balance", b"20")
old.len()
})
print("{r!}")
kv.close()
}Вывод
2
@derive(Copy)
pub(api) data KvTxС версии. 1.0.0-beta
Поля
pub(api) t: i64 | Handle of the transaction in the runtime. |
Методы
get | (key: str) -> bytes?The value of key as this transaction sees it (its own writes included), or none. |
put | (key: str, value: bytes)Stores value under key when the transaction commits. |
delete | (key: str)Removes key when the transaction commits. |
Определено в: std/kv/kv.oxl:232