OxL Reference

method Kv.scan

Entries whose key starts with prefix, ascending; at most limit (0 = all).

Example:

oxl✓ checked in CI
use std.kv { Kv }
use std.core { Utf8 }

fn main() io, db {
  let kv = Kv.open("example-scan")!
  kv.put("a/1", Utf8.encode("x"))!
  kv.put("a/2", Utf8.encode("y"))!
  kv.put("b/1", Utf8.encode("z"))!
  print("{kv.scan("a/", 0)!.len()}")
  kv.close()
}
Output
2
pub(api) fn scan(prefix: str, limit: i64) -> List<KvEntry> | KvError  db

Since. 1.0.0-beta

Parameters

NameType
prefixstr
limiti64

Returns

List<KvEntry>

Errors

Effects

db

Defined in: std/kv/kv.oxl:532

See also