octo3.
octo3.5mo ago

Is there a way to specify a range and list from KV?

const kv = await Deno.openKv();
kv.set(["parent", 1], "key1")
kv.set(["parent", 2], "key1")
kv.set(["parent", 3], "key1")
kv.set(["parent", 4], "key1")
const kv = await Deno.openKv();
kv.set(["parent", 1], "key1")
kv.set(["parent", 2], "key1")
kv.set(["parent", 3], "key1")
kv.set(["parent", 4], "key1")
Is it possible to retrieve only those of these that match the content of ["parent", 1~3] ?
3 Replies
octo3.
octo3.5mo ago
The condition of less than or equal to 3 is also acceptable.
cknight
cknight5mo ago
You want the list interface. Here's how it might look:
const entries = await Array.fromAsync(kv.list({start: ["parent", 1], end: ["parent", 3]});
const entries = await Array.fromAsync(kv.list({start: ["parent", 1], end: ["parent", 3]});
There's also the getMany interface to get multiple keys at once. https://deno.land/api@v1.41.3?s=Deno.Kv&unstable=&p=prototype.getMany
octo3.
octo3.5mo ago
@cknight Thank you. Understood
More Posts
PermissionDenied while using ioredis npm packageHello, I'm facing an issue with an npm library ioredis (https://github.com/redis/ioredis). For someIs there a way to obtain Deno.cron schedule info?Deploy lists the registered cron jobs with name, schedule, last run and next run. Is there a programVisual Studio Code Deno does not use node typesI'm trying to use the "esquery" node library with its types, but for any reason Deno ignores the typDrop permissionsI'd like to harden my deno app a bit, but specifying permissions manually gets repetitive. Is there New fresh project comes out of the box with errorsI created a new fresh project on linux, I am using VsCode and im getting many errors although the prIs there a deno function for inputting prompt reply without pressing enter?Normally, one has to press enter for the input to be accepted. I was wondering if there was a versioSetting Deno.Command priority and affinity (on windows)Is it possible to set a tasks / commands priority and affinity directly? Code: ```ts await new DenoIs there a way to write a Deno.AtomicCheck that succeeds for any non-null versionstamp?You can write a Deno.AtomicCheck that fails if the versionstamp for a key-value pair in the KV storeImportTypeScript API + get value of `compilerOptions` with default options from `tsconfig.json`?Hello, I'm trying to figure out the proper way to do a few things: 1. What's the correct way to impHow to override the version from a dependency of a project's dependency from npmI'm currently using react-pdf as a dependency, react-pdf uses fontkit as a dependency, and fontkit u