Crate worker_kv[][src]

Bindings to Cloudflare Worker’s KV to be used inside of a worker’s context.

Example

let kv = KvStore::create("Example")?;

// Insert a new entry into the kv.
kv.put("example_key", "example_value")
    .metadata(vec![1, 2, 3, 4]) // Use some arbitrary serialiazable metadata
    .execute()
    .await?;

// NOTE: kv changes can take a minute to become visible to other workers.
// Get that same metadata.
let (value, metadata) = kv.get_with_metadata::<Vec<usize>>("example_key").await?;

Structs

Key

The representation of a key in the KV store.

KvStore

A binding to a Cloudflare KvStore.

KvValue

A value fetched via a get request.

ListOptionsBuilder

A builder to configure list requests.

ListResponse

The response for listing the elements in a KV store.

PutOptionsBuilder

A builder to configure put requests.

Enums

KvError

A simple error type that can occur during kv operations.

Traits

ToRawKvValue

A trait for things that can be converted to wasm_bindgen::JsValue to be passed to the kv.