Skip to content

Commit 4360450

Browse files
authored
Update README.md
1 parent 8f926b1 commit 4360450

File tree

1 file changed

+32
-1
lines changed

1 file changed

+32
-1
lines changed

README.md

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,32 @@
1-
# PromiseSQL
1+
# PromiseSQL
2+
A lightweight module for running simple, promise-based SQLite3 queries in node.js. It works best in smaller projects with a lot of asynchronous development, e.g., a Discord bot with slash commands.
3+
4+
```javascript
5+
const db = require('promisesql');
6+
db.open('./database.db');
7+
8+
(async () => {
9+
const data = await db.select({
10+
all: true,
11+
from: 'lorem',
12+
where: [ db.expression.eq('ipsum', 'dolor') ]
13+
});
14+
15+
data.forEach(datum => console.log(datum.dolor));
16+
})();
17+
18+
db.close();
19+
```
20+
21+
This module is still a work in progress. By design, it was created as an SQL backend for interaction-based Discord bots built in [discord.js v13](https://discord.js.org/#/docs/discord.js/v13/general/welcome). It is intended to create more user-friendly, asynchronous query functions on top of [node-sqlite3](https://www.npmjs.com/package/sqlite3), which take in "options" objects as arguments, a practice inspired by discord.js. While it can run any query asychronous, it currently only supports the following built-in query and expression functions:
22+
23+
- Queries
24+
- Insert
25+
- Select
26+
- Update
27+
- Delete
28+
- Expressions
29+
- Boolean
30+
- Aggregate
31+
32+
Presently, there are no plans to add functionality such as creating tables, attaching databases, etc. For now, I handle operations like that with [DB Browser](https://sqlitebrowser.org/), which is a great tool for managing tables and data in small SQLite3 databases.

0 commit comments

Comments
 (0)