Skip to main content
type alias Deno.KvMutation
Unstable

A mutation to a key in a Deno.Kv. A mutation is a combination of a key, a value, and a type. The type determines how the mutation is applied to the key.

  • set - Sets the value of the key to the given value, overwriting any existing value.
  • delete - Deletes the key from the database. The mutation is a no-op if the key does not exist.
  • sum - Adds the given value to the existing value of the key. Both the value specified in the mutation, and any existing value must be of type Deno.KvU64. If the key does not exist, the value is set to the given value (summed with 0).
  • max - Sets the value of the key to the maximum of the existing value and the given value. Both the value specified in the mutation, and any existing value must be of type Deno.KvU64. If the key does not exist, the value is set to the given value.
  • min - Sets the value of the key to the minimum of the existing value and the given value. Both the value specified in the mutation, and any existing value must be of type Deno.KvU64. If the key does not exist, the value is set to the given value.
definition: { key: KvKey; } & (
| { type: "set"; value: unknown; }
| { type: "delete"; }
| { type: "sum"; value: KvU64; }
| { type: "max"; value: KvU64; }
| { type: "min"; value: KvU64; }
)