Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/rojvv/foundationdb_deno

FoundationDB for Deno
https://github.com/rojvv/foundationdb_deno

deno ffi foundationdb

Last synced: 4 months ago
JSON representation

FoundationDB for Deno

Awesome Lists containing this project

README

        

# FoundationDB for Deno

```ts
import {
createDatabase,
selectAPIVersion,
startNetwork,
stopNetwork,
} from "https://deno.land/x/fdb/mod.ts";

selectAPIVersion(710);
startNetwork();

const database = createDatabase();

const transaction = database.openTenant("yourTenant").createTransaction();
const future = transaction.get("yourKey");

future.blockUntilReady(); // or `future.setCallback`

future.getError(); // throws if the future has error

const value = future.getValue();

if (value == null) {
console.log("Key not found");
} else {
const string = new TextDecoder().decode(new Uint8Array(value));
console.log(`yourKey is ${string}`);
}

stopNetwork();
```