Skip to main content
Module

x/keywork/collections/mod.ts>KeyworkDocumentReference

A library for building V8 Isolate web apps on Cloudflare Workers, Deno, and Node.JS
Latest
class KeyworkDocumentReference
Re-export
import { KeyworkDocumentReference } from "https://deno.land/x/keywork@v6.2.1/collections/mod.ts";

Creates an instance associated with specific document within a Cloudflare KV.

Constructors

new
KeyworkDocumentReference(
kvNamespace: KVNamespace,
relativeDocPath: string,
parentCollection?: KeyworkCollection<ExpectedType>,
)

Type Parameters

optional
ExpectedType extends DeserializationTypes | { } = never

Properties

readonly
absoluteDocPath: string

A POSIX-style, absolute path to a document.

readonly
relativeDocPath: string

A POSIX-style, relative path to a document from a parent collection

Methods

fetchSnapshot(options?: KeyworkDocumentFetchOptions): Promise<KeyworkDocumentSnapshot<ExpectedType>>

Attempts to fetch a KeyworkDocumentSnapshot associated with the docPath.

If the deserializeAs option is not set, the type will attempt to be inferred from the parent collection's known metadata.

patchValue<E = ExpectedType>(
nextValue: Partial<E>,
options?: PutOrPatchOptions,
snapshot?: KeyworkDocumentSnapshot<E>,
deepMergeOptions?: any,
)

Updates the data associated with this document's path.

putValue<E = ExpectedType>(nextValue: Partial<E>, putOptions?: PutOrPatchOptions)

Overwrites the entire entity if it already exists, and creates a new resource if it doesn’t exist.