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