• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# EJDB2 Dart VM native binding
2
3Embeddable JSON Database engine http://ejdb.org Dart binding.
4
5See https://github.com/Softmotions/ejdb/blob/master/README.md
6
7For API usage examples take a look into [/example](https://github.com/Softmotions/ejdb/tree/master/src/bindings/ejdb2_dart/example) and [/test](https://github.com/Softmotions/ejdb/tree/master/src/bindings/ejdb2_dart/test) folders.
8
9## Example
10
11```dart
12import 'package:ejdb2_dart/ejdb2_dart.dart';
13
14void main() async {
15  final db = await EJDB2.open('example.db', truncate: true);
16
17  var id = await db.put('parrots', {'name': 'Bianca', 'age': 4});
18  print('Bianca record: ${id}');
19
20  id = await db.put('parrots', {'name': 'Darko', 'age': 8});
21  print('Darko record: ${id}');
22
23  final q = db.createQuery('/[age > :age]', 'parrots');
24  await for (final doc in q.setInt('age', 3).execute()) {
25    print('Found ${doc}');
26  }
27  await db.close();
28}
29```
30
31## Supported platforms
32
33* Linux x64
34* OSX
35
36## How build it manually
37
38Note: native binding requires Dart SDK version >= 2.12.x
39
40``` sh
41git clone https://github.com/Softmotions/ejdb.git
42cd ./ejdb
43mkdir ./build && cd build
44cmake .. -DBUILD_DART_BINDING=ON -DCMAKE_BUILD_TYPE=Release
45make
46cd src/bindings/ejdb2_dart/ejdb2_dart
47pub get
48```
49
50