@openland/foundationdb

@openland/foundationdb

  • Docs
  • Chat

›Reference

Getting Started

  • Getting Started
  • Installation
  • Hello world

Entity Layer

  • Overview

Layers

  • Singleton Worker
  • Migrations
  • PubSub
  • Random ID
  • Distributed Lock

Reference

  • Database
  • Transactions
  • Subspaces
  • Directory Layer

Database

To start working with client you need to create a Database object. Static method Database.open(path) open database synchronously and by default connects to a database that is installed on local machine. First optional argument is a path to a cluster file.

import { Database } from '@openland/foundationdb';
let db = await Database.open();

Closing Database

Closing database can be possible by simply calling asynchronous method Database.close():

await db.close();

Database for tests

For easier unit testing there is asynchronous method Database.openTest() that generates random key, creates instance of database that is isolated to this subspace and before returning clears all data in this subspace. You can provide optional argument name to use static prefix instead of generated one. This method will crash if NODE_ENV is equals production.

← Distributed LockTransactions →
Docs
Getting Started
Community
Chat in Openland
Sources
GitHubStar
Copyright © 2021 Openland