Skip to content

aapoalas/foundationdb_deno

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FoundationDB for Deno

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();

About

FoundationDB for Deno

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 100.0%