Class GKV<K, V>

Type Parameters

  • K = string
  • V = unknown

Constructors

  • Type Parameters

    • K = string
    • V = unknown

    Parameters

    • __namedParameters: {
          bucket: string;
          getBlobPath?: (namespace: string, key: K) => string;
          log?: Log;
          namespace?: string;
          storage: Storage;
      }

    Returns GKV<K, V>

Properties

bucket: string

The bucket name where data will be stored

getBlobPath: (namespace: string, key: K) => string = ...

A function for constructing paths to the stored data.

log?: Log

A log to write to in Google Cloud Logging. See docs here

namespace: string = "default"

A namespace ensures the data from your service is isolated in a direct child directory of the bucket

storage: Storage

A Storage instance. See docs here

Methods

  • Delete a key value pair

    Parameters

    • key: K

    Returns Promise<{ key: K; status: "deleted" | "error" }>

  • Get a value via its key

    Parameters

    • key: K

    Returns Promise<{ key: K; value: undefined | V }>

  • Set a new value, or overwrite an existing value

    Parameters

    • key: K
    • value: V

    Returns Promise<{ key: K; value: undefined | V }>

  • Update an existing value. Supports partial updates of deep objects

    Parameters

    • key: K
    • value: V

    Returns Promise<{ key: K; value: undefined | V }>