PostgresKvStorage
Defined in: src/storage/postgres.ts:56
A compare-and-swap capable storage backed by Postgres, plus close().
Extends
Section titled “Extends”Methods
Section titled “Methods”close()
Section titled “close()”close(): Promise<void>;Defined in: src/storage/postgres.ts:58
End the pool if this driver created it; no-op for a borrowed client.
Returns
Section titled “Returns”Promise<void>
compareAndSwap()
Section titled “compareAndSwap()”compareAndSwap<T>(input): Promise<boolean>;Defined in: src/storage/contract.ts:66
Atomically write next when the key currently holds a value structurally equal to expected
(object key order ignored), or is absent when expected is null. Resolves true when the
write happened. Of several concurrent swaps from the same expected, exactly one wins.
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
T |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
input |
CompareAndSwapInput<T> |
Returns
Section titled “Returns”Promise<boolean>
Inherited from
Section titled “Inherited from”CompareAndSwapKvStorage.compareAndSwap
getItem()
Section titled “getItem()”getItem<T>(key): Promise<T | null>;Defined in: src/storage/contract.ts:15
Read a value, or null if absent.
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
T |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
key |
string |
Returns
Section titled “Returns”Promise<T | null>
Inherited from
Section titled “Inherited from”CompareAndSwapKvStorage.getItem
getKeys()
Section titled “getKeys()”getKeys(prefix): Promise<string[]>;Defined in: src/storage/contract.ts:21
List all keys beginning with prefix (a plain, case-sensitive string prefix).
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
prefix |
string |
Returns
Section titled “Returns”Promise<string[]>
Inherited from
Section titled “Inherited from”CompareAndSwapKvStorage.getKeys
removeItem()
Section titled “removeItem()”removeItem(key): Promise<void>;Defined in: src/storage/contract.ts:19
Delete a key (no-op if absent).
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
key |
string |
Returns
Section titled “Returns”Promise<void>
Inherited from
Section titled “Inherited from”CompareAndSwapKvStorage.removeItem
setItem()
Section titled “setItem()”setItem<T>(key, value): Promise<void>;Defined in: src/storage/contract.ts:17
Write a value (overwriting any existing).
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
T |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
key |
string |
value |
T |
Returns
Section titled “Returns”Promise<void>