Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/rojvv/foundationdb_deno
- Owner: rojvv
- License: mit
- Created: 2023-03-11T16:39:15.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-03-27T14:54:15.000Z (almost 2 years ago)
- Last Synced: 2024-10-06T08:38:06.221Z (4 months ago)
- Topics: deno, ffi, foundationdb
- Language: TypeScript
- Homepage:
- Size: 32.2 KB
- Stars: 5
- Watchers: 2
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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();
```