Skip to main content
Deno 2 is finally here 🎉️
Learn more
Latest
class Tkv
import { Tkv } from "https://deno.land/x/tkv@v0.1.0/mod.ts";

Typed wrapper for Deno.Kv.

Type Parameters

K extends Deno.KvKey

Key type. For example: ["usersByEmail", email: string].

T

Value type. Type of values stored at the given keys.

Methods

atomicDelete(key: readonly [...K], versionstamp: Deno.AtomicCheck["versionstamp"]): ReturnType<Deno.AtomicOperation["commit"]>

Shorthand for Deno.AtomicOperation.check and Deno.AtomicOperation.delete.

atomicSet(
key: readonly [...K],
versionstamp: Deno.AtomicCheck["versionstamp"],
value: T,
options?: Parameters<Deno.AtomicOperation["set"]>[2],
): ReturnType<Deno.AtomicOperation["commit"]>

Shorthand for Deno.AtomicOperation.check and Deno.AtomicOperation.set.

delete(key: readonly [...K]): ReturnType<Deno.Kv["delete"]>

Typed wrapper for Deno.Kv.delete.

get(key: readonly [...K], options?: Parameters<Deno.Kv["get"]>[1]): Promise<TkvEntryMaybe<K, T>>

Typed wrapper for Deno.Kv.get.

list(selector: TkvListSelector<K>, options?: Parameters<Deno.Kv["list"]>[1]): TkvListIterator<K, T>

Typed wrapper for Deno.Kv.list.

set(
key: readonly [...K],
value: T,
options?: Parameters<Deno.Kv["set"]>[2],
): ReturnType<Deno.Kv["set"]>

Typed wrapper for Deno.Kv.set.