Skip to main content
Module

x/kvdex/mod.ts>IndexableCollection

Database wrapper for Deno KV
Go to Latest
class IndexableCollection
extends Collection<T1>
Re-export
import { IndexableCollection } from "https://deno.land/x/kvdex@v0.1.2/mod.ts";

Constructors

new
IndexableCollection(
kv: Deno.Kv,
collectionKey: KvKey,
indexRecord?: T2,
)

Represents a collection of documents stored in the KV store.

Contains methods to work on documents in the collection.

Type Parameters

T1 extends Model
T2 extends IndexRecord<T1>

Properties

readonly
primaryCollectionIndexKey: KvKey
readonly
primaryIndexList: string[]
readonly
secondaryCollectionIndexKey: KvKey
readonly
secondaryIndexList: string[]

Methods

add(data: T1)

Find a document by index value. Note that selecting an index that was not defined when creating the collection will always return null.

Finds documents by a given set of secondary indices. If multiple are specified, results are combined.

set(id: KvId, data: T1)