import { collection } from "https://deno.land/x/kvdex@v0.29.0/mod.ts";
Create a new collection within a database context.
Examples
Example 1
Example 1
import { model, collection, kvdex } from "https://deno.land/x/kvdex/mod.ts"
type User = {
username: string
age: number
}
const db = kvdex(kv, {
numbers: collection(model<number>()),
users: collection(model<User>(), {
idGenerator: () => crypto.randomUUID(),
serialized: true,
indices: {
username: "primary",
age: "secondary"
}
})
})