@possumtech/sqlrite 0.2.1 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -183,3 +183,5 @@ const sql = new SqlRite({ path: "path/to/your/database.sqlite3" });
183
183
 
184
184
  Additional arguments will be passed to the options object of the native sqlite
185
185
  module.
186
+
187
+ To close the database connection, call the `.close()` method:
package/SqlRite.js CHANGED
@@ -12,6 +12,8 @@ export default class SqlRite {
12
12
 
13
13
  const db = new DatabaseSync(merged.path, merged);
14
14
 
15
+ this.close = () => db.close();
16
+
15
17
  // allow multiple directories
16
18
  if (!Array.isArray(merged.dir)) merged.dir = [merged.dir];
17
19
  const files = merged.dir.flatMap((d) => this.getFiles(d));
@@ -70,6 +72,6 @@ export default class SqlRite {
70
72
  else if (item.endsWith(".sql")) files.push(path);
71
73
  }
72
74
 
73
- return files;
75
+ return files.sort();
74
76
  }
75
77
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@possumtech/sqlrite",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "description": "SQL Done Right",
5
5
  "keywords": [
6
6
  "node",
package/test/test.js CHANGED
@@ -17,3 +17,5 @@ sql.async.getPositions.all().then((positions) => console.log(positions));
17
17
  console.log(`The highest paid employee is ${employee.name}.`);
18
18
 
19
19
  sql.deleteTable();
20
+
21
+ sql.close();