refactor: rename Deno.openKv() to Deno.kv() (#18349)

This commit is contained in:
Ryan Dahl 2023-03-22 10:02:40 -04:00 committed by GitHub
parent e73e8410f6
commit 50b793c9ed
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 18 additions and 22 deletions

View file

@ -1535,7 +1535,7 @@ declare namespace Deno {
* @tags allow-read, allow-write
* @category KV
*/
export function openKv(path?: string): Promise<Deno.Kv>;
export function kv(path?: string): Promise<Deno.Kv>;
/** **UNSTABLE**: New API, yet to be vetted.
*
@ -1876,7 +1876,7 @@ declare namespace Deno {
* the returned entry will have a `null` value and versionstamp.
*
* ```ts
* const db = await Deno.openKv();
* const db = await Deno.kv();
* const result = await db.get(["foo"]);
* result.key; // ["foo"]
* result.value; // "bar"
@ -1902,7 +1902,7 @@ declare namespace Deno {
* entry will have a `null` value and versionstamp.
*
* ```ts
* const db = await Deno.openKv();
* const db = await Deno.kv();
* const result = await db.getMany([["foo"], ["baz"]]);
* result[0].key; // ["foo"]
* result[0].value; // "bar"
@ -1928,7 +1928,7 @@ declare namespace Deno {
* exists for the key, it will be overwritten.
*
* ```ts
* const db = await Deno.openKv();
* const db = await Deno.kv();
* await db.set(["foo"], "bar");
* ```
*/
@ -1939,7 +1939,7 @@ declare namespace Deno {
* for the key, this operation is a no-op.
*
* ```ts
* const db = await Deno.openKv();
* const db = await Deno.kv();
* await db.delete(["foo"]);
* ```
*/
@ -1971,7 +1971,7 @@ declare namespace Deno {
* not `["users", "noa"]` or `["users", "zoe"]`.
*
* ```ts
* const db = await Deno.openKv();
* const db = await Deno.kv();
* const entries = db.list({ prefix: ["users"] });
* for await (const entry of entries) {
* entry.key; // ["users", "alice"]