• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# EJDB2 React Native binding
2
3Embeddable JSON Database engine http://ejdb.org Node.js binding.
4
5See https://github.com/Softmotions/ejdb/blob/master/README.md
6
7
8## Note on versioning
9
10Since `2020-12-22` a new version scheme is used and the major version
11of package has been incremented. Now package version is the concatenation
12of ejdb2 core engine version and version serial number of this binding.
13For example: given ejdb2 version `2.0.52` and binding serial `2`
14the actual package version will be `2.0.522`.
15
16## Prerequisites
17
18- React native `0.61+`
19- [Yarn](https://yarnpkg.com) package manager
20
21## Status
22
23- Android
24- OSX not yet implemented, work in progress.
25
26## Getting started
27
28```
29yarn add ejdb2_react_native
30
31react-native link ejdb2_react_native
32```
33
34### Usage
35
36```js
37import { EJDB2, JBE } from 'ejdb2_react_native';
38
39// Simple query
40const db = await EJDB2.open('hello.db');
41await db.createQuery('@mycoll/[foo = :?]')
42        .setString(0, 'bar')
43        .useExecute(doc => {
44  const doc = doc.json;
45  console.log(`Document: `, doc);
46});
47
48db.close();
49```
50
51[See API docs](https://github.com/Softmotions/ejdb/blob/master/src/bindings/ejdb2_react_native/binding/index.d.ts) and [Tests](https://github.com/Softmotions/ejdb/blob/master/src/bindings/ejdb2_react_native/tests/App.js);
52
53## How build it manually
54
55```sh
56mkdir build && cd build
57cmake .. -DCMAKE_BUILD_TYPE=Release \
58         -DBUILD_REACT_NATIVE_BINDING=ON \
59         -DANDROID_NDK_HOME=<path to Android NDK> \
60         -DANDROID_ABIS="x86;x86_64;arm64-v8a;armeabi-v7a"
61```
62
63## Testing
64
65```sh
66mkdir build && cd build
67
68cmake .. -DCMAKE_BUILD_TYPE=Release \
69          -DBUILD_REACT_NATIVE_BINDING=ON \
70          -DANDROID_NDK_HOME=<path to Android NDK> \
71          -DANDROID_ABIS="x86" \
72          -DANDROID_AVD=TestingAVD \
73          -DBUILD_TESTS=ON
74
75ctest
76```
77