KeyworkDatabase
Overview
Usage
- Node
- Deno
- Browser/ESM
import { KeyworkDatabase } from 'keywork/collections'
import { KeyworkDatabase } from 'https://deno.land/x/keywork/collections'
let { KeyworkDatabase } = await import('https://esm.sh/keywork/collections')
Constructors
constructor
new KeyworkDatabase
(kvNamespace)
Parameters
Name | Type | Description |
---|---|---|
kvNamespace | KVNamespace<string> |
Defined in
collections/KeyworkDatabase.ts:24
Properties
kvNamespace
protected kvNamespace: `KVNamespace<string>`
The KV namespace binding provided by the parent Worker.
Defined in
collections/KeyworkDatabase.ts:26
Methods
collection
collection
(collectionPath): `Promise<[`KeyworkCollection<{} | [`DeserializationTypes`](../types/DeserializationTypes.mdx)>`](KeyworkCollection.mdx)>`
Gets a KeyworkCollection
instance that refers to a collection of documents.
Parameters
Name | Type |
---|---|
collectionPath | string |
Returns
Promise<[
KeyworkCollection<{} | DeserializationTypes
>](/modules/collections/classes/KeyworkCollection)>
Defined in
collections/KeyworkDatabase.ts:42
doc
doc
doc<ExpectedType>(docPath): [`KeyworkDocumentReference<`ExpectedType`>`](KeyworkDocumentReference.mdx)
Gets a KeyworkDocumentReference
instance that refers to the document at the specified absolute path.
Type parameters
Name | Type |
---|---|
ExpectedType | extends {} |
Parameters
Name | Type |
---|---|
docPath | string |
Returns
KeyworkDocumentReference<
ExpectedType>
Defined in
collections/KeyworkDatabase.ts:32
Creates a database instance backed by a Cloudflare KV namespace.