rozenite-sqlite 0.0.6 → 0.0.7
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/CHANGELOG.md +2 -20
- package/README.md +44 -1
- package/dist/rozenite.json +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,25 +1,7 @@
|
|
|
1
1
|
# rozenite-sqlite
|
|
2
2
|
|
|
3
|
-
## 0.0.
|
|
3
|
+
## 0.0.7
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
|
|
9
|
-
## 0.0.5
|
|
10
|
-
|
|
11
|
-
### Patch Changes
|
|
12
|
-
|
|
13
|
-
- update workflow
|
|
14
|
-
|
|
15
|
-
## 0.0.4
|
|
16
|
-
|
|
17
|
-
### Patch Changes
|
|
18
|
-
|
|
19
|
-
- add release action
|
|
20
|
-
|
|
21
|
-
## 0.0.3
|
|
22
|
-
|
|
23
|
-
### Patch Changes
|
|
24
|
-
|
|
25
|
-
- add workflow and readme
|
|
7
|
+
- update readme
|
package/README.md
CHANGED
|
@@ -19,6 +19,8 @@ Make sure you also have the Rozenite devtools set up in your project. Refer to t
|
|
|
19
19
|
|
|
20
20
|
Call `useRozeniteSQLite` once near the root of your app (or in the component that holds your database instances). The hook handles all communication with the devtools panel — you don't interact with the plugin bridge directly.
|
|
21
21
|
|
|
22
|
+
The `sqlExecutor` callback is fully library-agnostic — you provide the bridge between the plugin and whichever SQLite library you use. It receives the database name and a raw SQL string, and must return a `Promise<Record<string, unknown>[]>` (an array of row objects).
|
|
23
|
+
|
|
22
24
|
```tsx
|
|
23
25
|
import { useRozeniteSQLite } from 'rozenite-sqlite/react-native';
|
|
24
26
|
|
|
@@ -26,6 +28,7 @@ export default function App() {
|
|
|
26
28
|
useRozeniteSQLite({
|
|
27
29
|
databases: ['app.db', 'cache.db'],
|
|
28
30
|
sqlExecutor: async (dbName, query) => {
|
|
31
|
+
// Use any SQLite library here — see examples below
|
|
29
32
|
const db = myDatabases[dbName];
|
|
30
33
|
return db.getAllAsync(query);
|
|
31
34
|
},
|
|
@@ -35,7 +38,28 @@ export default function App() {
|
|
|
35
38
|
}
|
|
36
39
|
```
|
|
37
40
|
|
|
38
|
-
### With expo-sqlite
|
|
41
|
+
### With expo-sqlite (`openDatabaseSync`)
|
|
42
|
+
|
|
43
|
+
```tsx
|
|
44
|
+
import * as SQLite from 'expo-sqlite';
|
|
45
|
+
import { useRozeniteSQLite } from 'rozenite-sqlite/react-native';
|
|
46
|
+
|
|
47
|
+
export default function App() {
|
|
48
|
+
useRozeniteSQLite({
|
|
49
|
+
databases: ['app.db', 'cache.db'],
|
|
50
|
+
sqlExecutor: async (dbName, query) => {
|
|
51
|
+
const db = SQLite.openDatabaseSync(dbName);
|
|
52
|
+
return db.getAllSync(query) as Record<string, unknown>[];
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
// ...
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
> `openDatabaseSync` returns the existing open connection if the database is already open, so it's safe to call on every query without storing the instance.
|
|
61
|
+
|
|
62
|
+
### With expo-sqlite (`openDatabaseAsync`)
|
|
39
63
|
|
|
40
64
|
```tsx
|
|
41
65
|
import { useEffect, useState } from 'react';
|
|
@@ -68,6 +92,25 @@ export default function App() {
|
|
|
68
92
|
}
|
|
69
93
|
```
|
|
70
94
|
|
|
95
|
+
### With a custom native module
|
|
96
|
+
|
|
97
|
+
```tsx
|
|
98
|
+
import { useRozeniteSQLite } from 'rozenite-sqlite/react-native';
|
|
99
|
+
import SqliteServiceModule from './SqliteServiceModule';
|
|
100
|
+
|
|
101
|
+
export default function App() {
|
|
102
|
+
useRozeniteSQLite({
|
|
103
|
+
databases: ['app.db'],
|
|
104
|
+
sqlExecutor: async (dbName, query) => {
|
|
105
|
+
const result = await SqliteServiceModule.execute(dbName, query, true);
|
|
106
|
+
return JSON.parse(result) as Record<string, unknown>[];
|
|
107
|
+
},
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
// ...
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
71
114
|
### With op-sqlite
|
|
72
115
|
|
|
73
116
|
```tsx
|
package/dist/rozenite.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"rozenite-sqlite","version":"0.0.
|
|
1
|
+
{"name":"rozenite-sqlite","version":"0.0.7","description":"SQLite explorer for RN devtools","panels":[{"name":"SQLite","source":"/panel.html"}]}
|