MCPcopy Create free account
hub / github.com/docker/getting-started / init

Function init

app/src/persistence/sqlite.js:7–29  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

5let db, dbAll, dbRun;
6
7function init() {
8 const dirName = require('path').dirname(location);
9 if (!fs.existsSync(dirName)) {
10 fs.mkdirSync(dirName, { recursive: true });
11 }
12
13 return new Promise((acc, rej) => {
14 db = new sqlite3.Database(location, err => {
15 if (err) return rej(err);
16
17 if (process.env.NODE_ENV !== 'test')
18 console.log(`Using sqlite database at ${location}`);
19
20 db.run(
21 'CREATE TABLE IF NOT EXISTS todo_items (id varchar(36), name varchar(255), completed boolean)',
22 (err, result) => {
23 if (err) return rej(err);
24 acc();
25 },
26 );
27 });
28 });
29}
30
31async function teardown() {
32 return new Promise((acc, rej) => {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…