CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
sagemathinc

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: sagemathinc/cocalc
Path: blob/master/src/packages/hub/servers/database.ts
Views: 687
1
import { db } from "@cocalc/database";
2
3
// IMPORTANT: For typescript we make the default export have type PostgreSQL.
4
// In reality the default could be undefined until init gets called.
5
// We thus assume for convenience that init gets called before this default
6
// object gets used.
7
export let database: any = undefined;
8
9
export default function init(opts) {
10
if (database != null) {
11
throw Error("only call database init once");
12
}
13
database = db(opts);
14
}
15
16