method KvTx.get
The value of key as this transaction sees it (its own writes included), or none. The version read is validated at commit.
Example:
use std.kv { Kv }
fn main() io, db {
let kv = Kv.open("docs-kvtxget")!
kv.put("n", b"7")!
let r = kv.txn(tx => (tx.get("n") ?? b"").len())
print("{r!}")
kv.close()
}Output
1
pub(api) fn get(key: str) -> bytes?Since. 1.0.0-beta
Parameters
| Name | Type |
|---|---|
key | str |
Returns
bytes?
Effects
none declared (pure unless the body says otherwise)
Defined in: std/kv/kv.oxl:675