@petradb/engine 1.2.0 → 1.2.2
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 +12 -0
- package/index.d.ts +4 -0
- package/main.js +55297 -45592
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -24,6 +24,18 @@ const [{ rows }] = await db.execute('SELECT * FROM users');
|
|
|
24
24
|
console.log(rows); // [{ id: 1, name: 'Alice', email: 'alice@example.com' }]
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
+
### Persistent Storage
|
|
28
|
+
|
|
29
|
+
Data survives restarts with crash-safe durable storage in a single file:
|
|
30
|
+
|
|
31
|
+
```javascript
|
|
32
|
+
const db = new Session({ storage: 'persistent', path: './mydb' });
|
|
33
|
+
// ... use the database ...
|
|
34
|
+
db.close();
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Also available: `{ storage: 'text', path: './data.ptxt' }` for human-readable text files.
|
|
38
|
+
|
|
27
39
|
## Documentation
|
|
28
40
|
|
|
29
41
|
Full documentation, SQL reference, and API details are available at **[petradb.dev](https://petradb.dev)**.
|
package/index.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
export interface SessionOptions {
|
|
2
2
|
rowMode?: 'object' | 'array';
|
|
3
|
+
storage?: 'memory' | 'persistent' | 'text';
|
|
4
|
+
path?: string;
|
|
5
|
+
pageSize?: number;
|
|
3
6
|
}
|
|
4
7
|
|
|
5
8
|
export interface ExecuteOptions {
|
|
@@ -134,4 +137,5 @@ export class Session {
|
|
|
134
137
|
constructor(options?: SessionOptions);
|
|
135
138
|
execute(sql: string, options?: ExecuteOptions): Promise<ExecuteResult[]>;
|
|
136
139
|
prepare(sql: string): PreparedStatement;
|
|
140
|
+
close(): void;
|
|
137
141
|
}
|