quiverdb 0.6.0 → 0.6.1
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 +108 -108
- package/package.json +6 -1
package/README.md
CHANGED
|
@@ -1,108 +1,108 @@
|
|
|
1
|
-
# quiverdb
|
|
2
|
-
|
|
3
|
-
SQLite wrapper binding for Quiver via koffi FFI. Works with Node.js, Deno, and Bun.
|
|
4
|
-
|
|
5
|
-
## Requirements
|
|
6
|
-
|
|
7
|
-
- Node.js >= 20, Deno >= 2.0, or Bun >= 1.0
|
|
8
|
-
- `libquiver.dll` and `libquiver_c.dll` (or `.so`/`.dylib`) in system PATH
|
|
9
|
-
|
|
10
|
-
## Installation
|
|
11
|
-
|
|
12
|
-
```bash
|
|
13
|
-
npm install quiverdb
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
The native Quiver libraries must be compiled separately and available in your system PATH. See the Quiver project build instructions for details.
|
|
17
|
-
|
|
18
|
-
## Native Library Setup
|
|
19
|
-
|
|
20
|
-
This binding loads the Quiver C API library (`libquiver_c`) at runtime via koffi. The core library (`libquiver`) is a dependency that must also be loadable.
|
|
21
|
-
|
|
22
|
-
Options for making the libraries available:
|
|
23
|
-
|
|
24
|
-
1. Add the `build/bin/` directory to your system PATH
|
|
25
|
-
2. Copy both libraries to a directory already in PATH
|
|
26
|
-
3. Place both libraries alongside your application entry point
|
|
27
|
-
|
|
28
|
-
## Quick Start
|
|
29
|
-
|
|
30
|
-
```typescript
|
|
31
|
-
import { Database } from "quiverdb";
|
|
32
|
-
|
|
33
|
-
const db = Database.fromSchema("my.db", "schema.sql");
|
|
34
|
-
db.createElement("Items", { label: "Item 1", value: 42 });
|
|
35
|
-
|
|
36
|
-
const values = db.readScalarIntegers("Items", "value");
|
|
37
|
-
console.log(values); // [42]
|
|
38
|
-
|
|
39
|
-
db.close();
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
## API Methods
|
|
43
|
-
|
|
44
|
-
### Lifecycle
|
|
45
|
-
|
|
46
|
-
- `Database.fromSchema(dbPath, schemaPath)` -- Create database from SQL schema file
|
|
47
|
-
- `Database.fromMigrations(dbPath, migrationsPath)` -- Create database from migrations directory
|
|
48
|
-
- `close()` -- Close the database connection
|
|
49
|
-
|
|
50
|
-
### Create / Delete
|
|
51
|
-
|
|
52
|
-
- `createElement(collection, data)` -- Create element, returns numeric ID
|
|
53
|
-
- `deleteElement(collection, id)` -- Delete element by ID
|
|
54
|
-
|
|
55
|
-
### Read (bulk)
|
|
56
|
-
|
|
57
|
-
- `readScalarIntegers(collection, attribute)` -- Read all integer scalars
|
|
58
|
-
- `readScalarFloats(collection, attribute)` -- Read all float scalars
|
|
59
|
-
- `readScalarStrings(collection, attribute)` -- Read all string scalars
|
|
60
|
-
|
|
61
|
-
### Read (by ID)
|
|
62
|
-
|
|
63
|
-
- `readScalarIntegerById(collection, attribute, id)` -- Read integer or null
|
|
64
|
-
- `readScalarFloatById(collection, attribute, id)` -- Read float or null
|
|
65
|
-
- `readScalarStringById(collection, attribute, id)` -- Read string or null
|
|
66
|
-
|
|
67
|
-
### Read (IDs)
|
|
68
|
-
|
|
69
|
-
- `readElementIds(collection)` -- Read all element IDs in a collection
|
|
70
|
-
|
|
71
|
-
### Query
|
|
72
|
-
|
|
73
|
-
- `queryString(sql, params?)` -- Query returning string or null
|
|
74
|
-
- `queryInteger(sql, params?)` -- Query returning integer or null
|
|
75
|
-
- `queryFloat(sql, params?)` -- Query returning float or null
|
|
76
|
-
|
|
77
|
-
Parameters are passed as an array of `number | string | null`.
|
|
78
|
-
|
|
79
|
-
### Transaction
|
|
80
|
-
|
|
81
|
-
- `beginTransaction()` -- Begin explicit transaction
|
|
82
|
-
- `commit()` -- Commit current transaction
|
|
83
|
-
- `rollback()` -- Rollback current transaction
|
|
84
|
-
- `inTransaction()` -- Check if transaction is active
|
|
85
|
-
|
|
86
|
-
## Types
|
|
87
|
-
|
|
88
|
-
Exported types available for TypeScript consumers:
|
|
89
|
-
|
|
90
|
-
- `ScalarValue` -- `number | bigint | string | null`
|
|
91
|
-
- `ArrayValue` -- `number[] | bigint[] | string[]`
|
|
92
|
-
- `Value` -- `ScalarValue | ArrayValue`
|
|
93
|
-
- `ElementData` -- `Record<string, Value | undefined>`
|
|
94
|
-
- `QueryParam` -- `number | string | null`
|
|
95
|
-
- `QuiverError` -- Error class for all Quiver operations
|
|
96
|
-
|
|
97
|
-
## Development
|
|
98
|
-
|
|
99
|
-
```bash
|
|
100
|
-
bun test # Run all tests
|
|
101
|
-
bun run typecheck # TypeScript type checking (tsc --noEmit)
|
|
102
|
-
bun run lint # Biome linting
|
|
103
|
-
bun run format # Biome formatting (auto-fix)
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
## License
|
|
107
|
-
|
|
108
|
-
MIT
|
|
1
|
+
# quiverdb
|
|
2
|
+
|
|
3
|
+
SQLite wrapper binding for Quiver via koffi FFI. Works with Node.js, Deno, and Bun.
|
|
4
|
+
|
|
5
|
+
## Requirements
|
|
6
|
+
|
|
7
|
+
- Node.js >= 20, Deno >= 2.0, or Bun >= 1.0
|
|
8
|
+
- `libquiver.dll` and `libquiver_c.dll` (or `.so`/`.dylib`) in system PATH
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install quiverdb
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
The native Quiver libraries must be compiled separately and available in your system PATH. See the Quiver project build instructions for details.
|
|
17
|
+
|
|
18
|
+
## Native Library Setup
|
|
19
|
+
|
|
20
|
+
This binding loads the Quiver C API library (`libquiver_c`) at runtime via koffi. The core library (`libquiver`) is a dependency that must also be loadable.
|
|
21
|
+
|
|
22
|
+
Options for making the libraries available:
|
|
23
|
+
|
|
24
|
+
1. Add the `build/bin/` directory to your system PATH
|
|
25
|
+
2. Copy both libraries to a directory already in PATH
|
|
26
|
+
3. Place both libraries alongside your application entry point
|
|
27
|
+
|
|
28
|
+
## Quick Start
|
|
29
|
+
|
|
30
|
+
```typescript
|
|
31
|
+
import { Database } from "quiverdb";
|
|
32
|
+
|
|
33
|
+
const db = Database.fromSchema("my.db", "schema.sql");
|
|
34
|
+
db.createElement("Items", { label: "Item 1", value: 42 });
|
|
35
|
+
|
|
36
|
+
const values = db.readScalarIntegers("Items", "value");
|
|
37
|
+
console.log(values); // [42]
|
|
38
|
+
|
|
39
|
+
db.close();
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## API Methods
|
|
43
|
+
|
|
44
|
+
### Lifecycle
|
|
45
|
+
|
|
46
|
+
- `Database.fromSchema(dbPath, schemaPath)` -- Create database from SQL schema file
|
|
47
|
+
- `Database.fromMigrations(dbPath, migrationsPath)` -- Create database from migrations directory
|
|
48
|
+
- `close()` -- Close the database connection
|
|
49
|
+
|
|
50
|
+
### Create / Delete
|
|
51
|
+
|
|
52
|
+
- `createElement(collection, data)` -- Create element, returns numeric ID
|
|
53
|
+
- `deleteElement(collection, id)` -- Delete element by ID
|
|
54
|
+
|
|
55
|
+
### Read (bulk)
|
|
56
|
+
|
|
57
|
+
- `readScalarIntegers(collection, attribute)` -- Read all integer scalars
|
|
58
|
+
- `readScalarFloats(collection, attribute)` -- Read all float scalars
|
|
59
|
+
- `readScalarStrings(collection, attribute)` -- Read all string scalars
|
|
60
|
+
|
|
61
|
+
### Read (by ID)
|
|
62
|
+
|
|
63
|
+
- `readScalarIntegerById(collection, attribute, id)` -- Read integer or null
|
|
64
|
+
- `readScalarFloatById(collection, attribute, id)` -- Read float or null
|
|
65
|
+
- `readScalarStringById(collection, attribute, id)` -- Read string or null
|
|
66
|
+
|
|
67
|
+
### Read (IDs)
|
|
68
|
+
|
|
69
|
+
- `readElementIds(collection)` -- Read all element IDs in a collection
|
|
70
|
+
|
|
71
|
+
### Query
|
|
72
|
+
|
|
73
|
+
- `queryString(sql, params?)` -- Query returning string or null
|
|
74
|
+
- `queryInteger(sql, params?)` -- Query returning integer or null
|
|
75
|
+
- `queryFloat(sql, params?)` -- Query returning float or null
|
|
76
|
+
|
|
77
|
+
Parameters are passed as an array of `number | string | null`.
|
|
78
|
+
|
|
79
|
+
### Transaction
|
|
80
|
+
|
|
81
|
+
- `beginTransaction()` -- Begin explicit transaction
|
|
82
|
+
- `commit()` -- Commit current transaction
|
|
83
|
+
- `rollback()` -- Rollback current transaction
|
|
84
|
+
- `inTransaction()` -- Check if transaction is active
|
|
85
|
+
|
|
86
|
+
## Types
|
|
87
|
+
|
|
88
|
+
Exported types available for TypeScript consumers:
|
|
89
|
+
|
|
90
|
+
- `ScalarValue` -- `number | bigint | string | null`
|
|
91
|
+
- `ArrayValue` -- `number[] | bigint[] | string[]`
|
|
92
|
+
- `Value` -- `ScalarValue | ArrayValue`
|
|
93
|
+
- `ElementData` -- `Record<string, Value | undefined>`
|
|
94
|
+
- `QueryParam` -- `number | string | null`
|
|
95
|
+
- `QuiverError` -- Error class for all Quiver operations
|
|
96
|
+
|
|
97
|
+
## Development
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
bun test # Run all tests
|
|
101
|
+
bun run typecheck # TypeScript type checking (tsc --noEmit)
|
|
102
|
+
bun run lint # Biome linting
|
|
103
|
+
bun run format # Biome formatting (auto-fix)
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## License
|
|
107
|
+
|
|
108
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "quiverdb",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"description": "SQLite wrapper binding for Quiver via koffi FFI",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -15,6 +15,11 @@
|
|
|
15
15
|
"dist/"
|
|
16
16
|
],
|
|
17
17
|
"license": "MIT",
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "https://github.com/psrenergy/quiver",
|
|
21
|
+
"directory": "bindings/js"
|
|
22
|
+
},
|
|
18
23
|
"keywords": [
|
|
19
24
|
"sqlite",
|
|
20
25
|
"database",
|