import { kvdex } from "https://deno.land/x/kvdex@v0.27.0/mod.ts";
Create a new database instance.
Builds the database collections and forms the schema.
Examples
Example 1
Example 1
import { kvdex, model, collection } from "https://deno.land/x/kvdex/mod.ts"
type User = {
username: string
age: number
}
const kv = await Deno.openKv()
const db = kvdex(kv, {
numbers: collection(model<number>()),
u64s: collection(model<Deno.KvU64>()),
serializedStrings: collection(model<string>(), { serialize: "auto" }),
users: collection(model<User>(), {
indices: {
username: "primary",
age: "secondary"
}
})
})
Type Parameters
T extends SchemaDefinition