replDb API
ReplDB is a simple key-value store available on all repls by default. Extensions can use ReplDB to store repl specific data.
Usage
import { replDb } from '@replit/extensions';
Methods
replDb.set
Sets the value for a given key. Required permissions: repldb:read
, repldb:write
.
set(args: { key: string, value: any }): Promise<void>
replDb.get
Returns a value associated with the given key. Required permissions: repldb:read
.
get(args: { key: string }): Promise<string | { error: null | string }>
replDb.list
Lists keys in the replDb. Accepts an optional prefix
, which filters for keys beginning with the given prefix. Required permissions: repldb:read
.
list(args: { prefix: string }): Promise<{ keys: string[] } | { error: string }>
replDb.del
Deletes a key in the replDb. Required permissions: repldb:read
, repldb:write
.
del(args: { key: string }): Promise<void>