Skip to content

v0.4.0 release #60

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 165 commits into from
Oct 31, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
165 commits
Select commit Hold shift + click to select a range
88dd2d3
Implement query and builder related ffi functions
Buggaboo Sep 19, 2019
bb470cd
at least op overloading is working...
Buggaboo Sep 20, 2019
bd7a32e
minor typo
Buggaboo Sep 20, 2019
a8c849b
another attempt to fix the test
Buggaboo Sep 20, 2019
26e5b33
focus, do aliases later
Buggaboo Sep 20, 2019
39e6a8c
streamline enums
Buggaboo Sep 20, 2019
e820156
Finalized query condition design, also got tests running
Buggaboo Sep 20, 2019
15e9b7a
added operator overloads for int properties
Buggaboo Oct 2, 2019
7698354
added queryAny and queryAll to the box
Buggaboo Oct 2, 2019
23bb90f
added contains / contain to the party
Buggaboo Oct 2, 2019
004bcd2
added close to new queries
Buggaboo Oct 2, 2019
07a5059
updated dummy type for isNull / notNull
Buggaboo Oct 2, 2019
0d2e907
cleaned up tests
Buggaboo Oct 2, 2019
2b3b91b
added tests for double and booleans (both are not supported atm)
Buggaboo Oct 2, 2019
0b19c16
added implementation and tests for `in`, `notIn`, `greater`, `less`
Buggaboo Oct 2, 2019
b14c10c
updated test for `contain` and `contains` for String
Buggaboo Oct 2, 2019
b9c5189
* Modified function signature of find find_ids, maybe unnecessary
Buggaboo Oct 3, 2019
e81d351
Merge branch 'query' into dev-query
Buggaboo Oct 3, 2019
6690bd2
minor cleanup
Buggaboo Oct 3, 2019
231c781
updated readme
Buggaboo Oct 3, 2019
e80fe14
forgot symbol associativity
Buggaboo Oct 8, 2019
42f1152
added bool and double to supported types, still segfaulting on isNull…
Buggaboo Oct 9, 2019
b9ae9d9
try finally resource release
Buggaboo Oct 9, 2019
7481113
Merge branch 'dev' into dev-query
Buggaboo Oct 9, 2019
81895fd
renamed disjunctive normal form (dnf) to anyGroup
Buggaboo Oct 9, 2019
6c5bc56
Implemented other `free` functions for struct pointers
Buggaboo Oct 9, 2019
114d183
changed limit default to zero
Buggaboo Oct 9, 2019
462f74c
renamed condition operators
Buggaboo Oct 9, 2019
06fe677
_queryBuilderPtr -> _cBuilder
Buggaboo Oct 9, 2019
1f868a2
oops, corrected cop in params
Buggaboo Oct 9, 2019
0e2f88e
Added comment about type aliases
Oct 10, 2019
e34f02a
changed the ffi function return types for query_find(_ids) to Uint64,
Buggaboo Oct 10, 2019
55d7f70
kill your darlings: removed queryAll/queryAny that applies a reduce o…
Buggaboo Oct 10, 2019
dbcbe0f
kill your darlings: removed qb_strings_contain for Vector<String> types
Buggaboo Oct 10, 2019
768a7ef
moved out QueryBuilder into its own file within the internal library …
Buggaboo Oct 10, 2019
c9c0a0e
Merge branch 'dev-query' of github.com:Buggaboo/objectbox-dart into d…
Buggaboo Oct 10, 2019
be2aa90
Introduced support for other int-ish types.
Buggaboo Oct 11, 2019
e454a52
Moved out OBXOrderFlag to constants
Buggaboo Oct 11, 2019
ce1e0e3
removed unused generic param
Buggaboo Oct 11, 2019
1e91e20
Merge branch 'dev' into dev-query
Buggaboo Oct 11, 2019
bc05781
wrong number of params
Buggaboo Oct 12, 2019
df00e23
implemented manual type mapping
Buggaboo Oct 12, 2019
cbb44aa
fixed bad merge
Buggaboo Oct 12, 2019
9e8f49a
reimplemented find/findFirst
Buggaboo Oct 13, 2019
9497784
added bounds check to findFirst
Buggaboo Oct 13, 2019
75101fe
fixed minor issues with tests
Buggaboo Oct 13, 2019
b164fb5
added describe(_params)
Buggaboo Oct 13, 2019
d4d6613
oops
Buggaboo Oct 13, 2019
43324e0
added bool to integer conditions
Buggaboo Oct 13, 2019
5b36eda
corrected "dynamic" issue (dart type analysis hickup), and fixed oops…
Buggaboo Oct 13, 2019
ddeef77
corrected skewed tree construction and minimized the number of condit…
Buggaboo Oct 14, 2019
2987190
Merge branch 'dev' into dev-query
Buggaboo Oct 14, 2019
13e8c0e
Merge branch 'dev' into dev-query
Buggaboo Oct 14, 2019
aebd560
IntegerQuery apply simplification
vaind Oct 15, 2019
81c3ac5
create scoped TestEnv for tests
vaind Oct 15, 2019
b1fae6a
define and use OBX_id_array ffi struct
vaind Oct 15, 2019
00f60cc
updated README
Buggaboo Oct 16, 2019
02c656a
Merge pull request #1 from vaind/dev-query
Buggaboo Oct 16, 2019
92259ae
Merge branch 'dev-query' of github.com:Buggaboo/objectbox-dart into d…
Buggaboo Oct 16, 2019
4f0c2cf
replaced fields from Entity_ with named params
Buggaboo Oct 16, 2019
bfc0bc4
removed unused variables
Buggaboo Oct 16, 2019
3fae217
Renamed QueryCondition to ConditionGroup
Buggaboo Oct 16, 2019
57d9325
Renamed
Buggaboo Oct 16, 2019
3cccbf3
bindings no longer looks in lib automagically
Buggaboo Oct 16, 2019
9bd3951
create scoped TestEnv for tests
vaind Oct 17, 2019
196f964
streamline Query any/all grouping using ConditionGroup
vaind Oct 17, 2019
c9e0e32
Merge branch 'master' into dev
vaind Oct 17, 2019
c6579ad
privatize QueryProperty internals so they don't pollute query code co…
vaind Oct 17, 2019
6a0d7ba
setup pedantic lint rules for Effective Dart
RandomDalek Oct 9, 2019
702fbbd
fix avoid_init_to_null warning
RandomDalek Oct 9, 2019
e04131b
fix unnecessary_const and avoid_shadowing_type_parameters warnings
RandomDalek Oct 9, 2019
135f954
fix avoid_types_as_parameter_names warning
RandomDalek Oct 9, 2019
ea4d72d
fix expected output after avoid_init_to_null change.
GregorySech Oct 9, 2019
805de34
fix unused_import warning
GregorySech Oct 9, 2019
4a01806
fix curly_braces_in_flow_control_structures warning
GregorySech Oct 9, 2019
47b61e0
fix unnecessary_new warning
GregorySech Oct 9, 2019
434c322
fix prefer_contains warning
GregorySech Oct 9, 2019
76870d7
fix prefer_is_empty warning
GregorySech Oct 9, 2019
afced50
fix unawaited_futures warning
GregorySech Oct 10, 2019
83fb466
format using dartfmt
vaind Oct 17, 2019
479e8a6
Revert "bindings no longer looks in lib automagically"
Buggaboo Oct 19, 2019
dabcaa9
Merge pull request #2 from vaind/dev-query
Buggaboo Oct 19, 2019
9cc3318
Merge branch 'dev-query' of github.com:Buggaboo/objectbox-dart into d…
Buggaboo Oct 19, 2019
0538b4d
Merge branch 'dev' into dev-query
Buggaboo Oct 19, 2019
075f5bd
Added workaround for signed dart binary issue from brew
Buggaboo Oct 19, 2019
e693c07
comment clean up
Buggaboo Oct 19, 2019
30efd33
implemented .count(), .isEmpty(), .removeAll(); ready for PR
liquidiert Oct 20, 2019
80f0b1f
add query condition grouping tests
vaind Oct 21, 2019
7758a14
added .remove(), .removeMany() methods and seperate unit tests
liquidiert Oct 21, 2019
8ddd202
query - remove double equality operator support for now
vaind Oct 21, 2019
1303491
format the sources using dartfmt
vaind Oct 21, 2019
5d07ad1
update the generator test case to reflect include a query-support class
vaind Oct 21, 2019
535e875
Merge branch 'query' into dev
vaind Oct 21, 2019
c30d800
expand box count & remove tests
vaind Oct 21, 2019
7b1041f
Merge branch 'liquidiert-master' into dev
vaind Oct 21, 2019
5eb9210
merge related changes
vaind Oct 21, 2019
4895d3e
remove test groups, they may cause uninitialized Box in improperly me…
vaind Oct 21, 2019
57ed740
resolve a couple of linter issues
vaind Oct 21, 2019
5339a52
implemented .contains/Many(); test fails for query.describe()
liquidiert Oct 21, 2019
6b8e36f
implemented querybuilder.order
Buggaboo Oct 21, 2019
e2f1231
remove leading underscore from box methods' local vars
vaind Oct 22, 2019
63037e4
disable linter rule: unrelated_type_equality_checks due to query oper…
vaind Oct 22, 2019
9aa9f59
Merge pull request #46 from Buggaboo/order-dev
vaind Oct 22, 2019
907af5a
rename OBXOrderFlag to Order and move to be exported by default
vaind Oct 22, 2019
991ea6c
refactored local variables
liquidiert Oct 22, 2019
4ad93fd
Merge branch 'dev' into devquid
liquidiert Oct 22, 2019
45d4d9d
dartfmt
vaind Oct 22, 2019
f972052
test formatting
vaind Oct 22, 2019
2e659a2
moved bin/objectbox_model_generator to ./generator
vaind Oct 22, 2019
f717e15
moved examples to example - where `pana` expects it
vaind Oct 22, 2019
54487ad
resolve "unnecessary new keyword" in generated code
vaind Oct 22, 2019
c6ee262
implemented write transactions
liquidiert Oct 22, 2019
abf83aa
additional unit tests for transactions
liquidiert Oct 23, 2019
72a0bae
transactions rethrow and get marked unsuccessful if mode == TxMode.Write
liquidiert Oct 23, 2019
b2a3134
txn exception test
liquidiert Oct 23, 2019
ff1c8a7
catch all exceptions
liquidiert Oct 23, 2019
0a52e68
fixed exception test
liquidiert Oct 23, 2019
6ec433d
Merge pull request #50 from liquidiert/devquid
vaind Oct 23, 2019
5d1fe7a
print-out model.json into the generated file to avoid loading it at r…
vaind Oct 25, 2019
c13c616
correct native error message building
vaind Oct 25, 2019
a800282
model - set last property ID from the model, not the last present pro…
vaind Oct 28, 2019
8eaea82
Add initial mobile Flutter demo project
nalenz-objectbox Oct 25, 2019
180f876
flutter demo - add objectbox.aar locally temporarily
vaind Oct 25, 2019
56d9b96
change example app package ID to io.objectbox.flutterexample
nalenz-objectbox Oct 28, 2019
0402cc6
Add path_provider and intl dependencies to Flutter demo
nalenz-objectbox Oct 26, 2019
d407039
flutter demo - display and remove notes
nalenz-objectbox Oct 26, 2019
befa5f6
clean up native model building & fix error handling;
vaind Oct 29, 2019
e3c7996
simple integration tests
vaind Oct 29, 2019
ef10287
wrap Utf8.fromUtf8 to check null pointers
vaind Oct 29, 2019
703a040
make native array-based calls compatible with 32-bit platforms
vaind Oct 29, 2019
2ead86a
use native OBX_bytes_array helper functions to build, until we can ma…
vaind Oct 29, 2019
7c91659
rename docs to doc
vaind Oct 30, 2019
a19a788
flutter demo: use published objectbox-android
vaind Oct 30, 2019
1ff3efa
flutter demo: fix delete after insert
vaind Oct 30, 2019
a345775
update pubspec - add missing info
vaind Oct 30, 2019
5b49e02
split out contribution guidelines to a separate file
vaind Oct 30, 2019
232f46a
change example page to only list the mobile demo at the moment
vaind Oct 30, 2019
7f9f365
Merge pull request #61 from objectbox/8-mobile-example
vaind Oct 30, 2019
9c637c9
revert an unintentional flutter SDK dependency
vaind Oct 30, 2019
7880961
rename query condition notEqual() to notEquals() to align with the re…
vaind Oct 30, 2019
bff2ccc
exclude example and generator from analysis
vaind Oct 30, 2019
9d151c1
drop query condition `==` operator override for now, until it can be …
vaind Oct 30, 2019
f712515
linter: non_constant_identifier_names
vaind Oct 30, 2019
a152daa
bump package version: 0.4.0-dev.2
vaind Oct 30, 2019
1308142
move integration test TODO out of the docs section
vaind Oct 30, 2019
bbd6c14
Remove objectbox-model.json asset from objectbox_demo
nalenz-objectbox Oct 31, 2019
1cd200a
Prevent adding empty notes in objectbox_demo
nalenz-objectbox Oct 31, 2019
2dc1c0e
Fix date handling in Flutter demo
nalenz-objectbox Oct 31, 2019
d4ffb1e
Fix putMany test case
nalenz-objectbox Oct 31, 2019
b2dc25b
Add test case for 64 bit integer limits (#63)
nalenz-objectbox Oct 31, 2019
48852e5
rename objectbox_model_generator to objectbox_generator
vaind Oct 31, 2019
67993ca
generator - prepare for publishing
vaind Oct 31, 2019
2d99df1
exclude the example folder from code generation by default
vaind Oct 31, 2019
fafde37
Merge pull request #64 from objectbox/63-test-integer-limits
vaind Oct 31, 2019
98208af
rework readme
vaind Oct 31, 2019
d426c8f
remove query/index.dart in favor of query/query.dart
vaind Oct 31, 2019
a2efdbf
Remove test index.dart
nalenz-objectbox Oct 31, 2019
fa51c1f
reorganize a query test to be more readable
vaind Oct 31, 2019
b571130
handle box.remove() not-found without catching exceptions
vaind Oct 31, 2019
6b89922
Add test for null properties
nalenz-objectbox Oct 31, 2019
32f6984
Merge pull request #67 from objectbox/65-test-null-properties
nalenz-objectbox Oct 31, 2019
5547411
fix generator test runner after a dependency update
vaind Oct 31, 2019
93759ce
Merge remote-tracking branch 'origin/dev' into dev
vaind Oct 31, 2019
e481959
doc: add build_runner info to the readme
vaind Oct 31, 2019
76ee673
prepare v0.4.0
vaind Oct 31, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/dart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ jobs:
steps:
- uses: actions/checkout@v1
- name: Install dependencies
working-directory: bin/objectbox_model_generator
working-directory: generator
run: pub get
- name: Run tests
working-directory: bin/objectbox_model_generator
working-directory: generator
run: pub run test

lib:
Expand Down
20 changes: 17 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,28 @@
0.4.0 (2019-10-31)
------------------
* Flutter Android support
* Queries for all currently supported types
(thanks [Jasm Sison](https://github.com/Buggaboo) for [#27](https://github.com/objectbox/objectbox-dart/pull/27) and [#46](https://github.com/objectbox/objectbox-dart/pull/46)]
* More Box functions (count, isEmpty, contains, remove and their bulk variants)
(thanks [liquidiert](https://github.com/liquidiert) for [#42](https://github.com/objectbox/objectbox-dart/pull/42) and [#45](https://github.com/objectbox/objectbox-dart/pull/45)]
* Explicit write transactions
(thanks [liquidiert](https://github.com/liquidiert) for [#50](https://github.com/objectbox/objectbox-dart/pull/50)]
* Resolved linter issues
(thanks [Gregory Sech](https://github.com/GregorySech) for [#31](https://github.com/objectbox/objectbox-dart/pull/31)]
* Updated to objectbox-c 0.7.2
* First release on pub.dev

0.3.0 (2019-10-15)
------------------
* ID/UID generation and model persistence (objectbox-model.json)
* CI tests using GitHub Actions
* Code cleanup, refactoring and formatting
(thanks [Buggaboo](https://github.com/Buggaboo) for [#20](https://github.com/objectbox/objectbox-dart/pull/20) & [#21](https://github.com/objectbox/objectbox-dart/pull/21)]
(thanks [Jasm Sison](https://github.com/Buggaboo) for [#20](https://github.com/objectbox/objectbox-dart/pull/20) & [#21](https://github.com/objectbox/objectbox-dart/pull/21)]

0.2.0 (2019-09-11)
------------------
------------------Buggaboo
* UTF-8 support for Store and Box
(thanks to [Buggaboo](https://github.com/Buggaboo) for [#14](https://github.com/objectbox/objectbox-dart/pull/14)!)
(thanks to [Jasm Sison](https://github.com/Buggaboo) for [#14](https://github.com/objectbox/objectbox-dart/pull/14)!)
* Bulk put and get functions (getMany, getAll, putMany)
* Updated to objectbox-c 0.7
* Basic Store options
Expand Down
30 changes: 30 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
Contributing
------------------
This project is completely managed on GitHub using its [issue tracker](https://github.com/objectbox/objectbox-dart/issues) and [project boards](https://github.com/objectbox/objectbox-dart/projects).

Anyone can contribute, be it by coding, improving docs or just proposing a new feature.
Look for tasks having a [**"help wanted"**](https://github.com/objectbox/objectbox-dart/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22) tag.
When picking up an existing issue, please let us know in the issue comment.
Don't hesitate to reach out for guidance or to discuss a solution proposal!

### Code contributions
When creating a Pull Request for code changes, please check that you cover the following:
* Include tests for the changes you introduce. See the [test folder](test) for examples.
* Formatted the code using `dartfmt -l 120`. You can configure your IDE to do this automatically,
e.g. VS Code needs the project-specific settings `"editor.defaultFormatter": "Dart-Code.dart-code"` and `"dart.lineLength": 120`.

### Project workflow
Issues on the [project board](https://github.com/objectbox/objectbox-dart/projects/3) are referred to as "cards" which move from left to right:

* New cards start in the "To Do" column.
Within the column, cards are ordered: more important tasks should be above less important ones.
* Once somebody starts on a task, the according card is moved to "In progress".
Also, please assign yourself to the issue.
* Once a task is considered complete (e.g. PR is made), put it in the "Review" column.
* Once another person had a look and is happy, the task is finally moved to "Done" and its closed.

### Basic technical approach
ObjectBox offers a [C API](https://github.com/objectbox/objectbox-c) which can be called by [Dart FFI](https://dart.dev/server/c-interop).
The C API is is also used by the ObjectBox language bindings for [Go](https://github.com/objectbox/objectbox-go), [Swift](https://github.com/objectbox/objectbox-swift), and [Python](https://github.com/objectbox/objectbox-python).
These language bindings currently serve as an example for this Dart implementation.
Internally, ObjectBox uses [FlatBuffers](https://google.github.io/flatbuffers/) to store objects.
160 changes: 102 additions & 58 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,56 +2,50 @@ ObjectBox for Dart/Flutter
==========================
ObjectBox for Dart is a standalone database storing Dart objects locally, with strong ACID semantics.

Help wanted
-----------
ObjectBox for Dart is still in a prototype stage supporting only the most basic database tasks, like putting and getting objects.
However, the ObjectBox core supports many more features, e.g. queries, indexing, async operations, transaction control.
To bring all these features to Dart, we're asking the community to help out. PRs are more than welcome!
The ObjectBox team will try its best to guide you and answer questions.

Contributing
------------------
This project is completely managed here on GitHub using its [issue tracker](https://github.com/objectbox/objectbox-dart/issues) and [project boards](https://github.com/objectbox/objectbox-dart/projects).

To prepare an upcoming version, we create a (Kanban like) board for it.
Once it is decided which features and fixes go into the version, the according issues are added to the board.
Issues on the board are referred to as "cards" which move from left to right:

* New cards start in the "To Do" column.
Within the column, cards are ordered: more important tasks should be above less important ones.
* Once somebody starts on a task, the according card is moved to "In progress".
Also, please assign yourself to the issue.
* Once a task is considered complete (e.g. PR is made), put it in the "Review" column.
* Once another person had a look and is happy, the task is finally moved to "Done"

Anyone can contribute, be it by coding, improving docs or just proposing a new feature.
Look for tasks having a **"help wanted"** tag.

#### Feedback
Also, please let us know your feedback by opening an issue:
for example, if you experience errors or if you have ideas for how to improve the API.
Thanks!
Installation
------------
Add the following dependencies to your `pubspec.yaml`:
```yaml
dependencies:
objectbox: ^0.4.0

dev_dependencies:
build_runner: ^1.0.0
objectbox_generator: ^0.4.0
```

#### Code style
Please make sure that all code submitted via Pull Request is formatted using `dartfmt -l 120`.
You can configure your IDE to do this automatically, e.g. VS Code needs the project-specific settings
`"editor.defaultFormatter": "Dart-Code.dart-code"` and `"dart.lineLength": 120`.
Proceed based on whether you're developing a Flutter app or a standalone dart program:
1. **Flutter** only steps:
* Install the packages `flutter pub get`
* Add `objectbox-android` dependency to your `android/app/build.gradle`
```
dependencies {
implementation "io.objectbox:objectbox-android:2.4.1"
...
```
* iOS coming soon
1. **Dart standalone programs**:
* Install the packages `pub get`
* Install [objectbox-c](https://github.com/objectbox/objectbox-c) system-wide:
* macOS/Linux: execute the following command (answer Y when it asks about installing to /usr/lib)
```shell script
bash <(curl -s https://github.com/raw/objectbox/objectbox-c/master/download.sh) 0.7.2
```
* macOS: if dart later complains that it cannot find the `libobjectbox.dylib` you probably have to unsign the
`dart` binary (source: [dart issue](https://github.com/dart-lang/sdk/issues/38314#issuecomment-534102841)):
```shell script
sudo xcode --remove-signature $(which dart)
```
* Windows: use "Git Bash" or similar to execute the following command
```shell script
bash <(curl -s https://github.com/raw/objectbox/objectbox-c/master/download.sh) 0.7.2
```
Then copy the downloaded `lib/objectbox.dll` to `C:\Windows\System32\` (requires admin privileges).

ObjectBox generates code binding code for classes you want stored based using build_runner.
After you've defined your persisted entities (see below), run `pub run build_runner build` or `flutter pub run build_runner build`.

Getting started
---------------
To try out the demo code in this repository, follow these steps:

1. Install [objectbox-c](https://github.com/objectbox/objectbox-c) system-wide:
* macOS/Linux: `bash <(curl -s https://github.com/raw/objectbox/objectbox-c/master/download.sh) 0.7` (answer Y when it asks about installing to /usr/lib).
* Windows:
* use "Git Bash" or similar to execute `bash <(curl -s https://github.com/raw/objectbox/objectbox-c/master/download.sh) 0.7`
* copy the downloaded `lib/objectbox.dll` to `C:\Windows\System32\` (requires admin privileges)
2. Back in this repository, run `pub get`.
3. Execute `pub run build_runner build`. This regenerates the ObjectBox model to make it usable in Dart
(i.e. the file `test/test.g.dart`) and is necessary each time you add or change a class annotated with `@Entity(...)`.
4. Finally run `pub run test` to run the unit tests.

Dart integration
----------------
In general, Dart class annotations are used to mark classes as ObjectBox entities and provide meta information.
Note that right now, only a limited set of types is supported; this will be expanded upon in the near future.
Expand Down Expand Up @@ -98,20 +92,70 @@ print("refetched note: ${box.get(note.id)}");
store.close();
```

Basic technical approach
------------------------
ObjectBox offers a [C API](https://github.com/objectbox/objectbox-c) which can be called by [Dart FFI](https://dart.dev/server/c-interop).
The C API is is also used by the ObjectBox language bindings for [Go](https://github.com/objectbox/objectbox-go), [Swift](https://github.com/objectbox/objectbox-swift), and [Python](https://github.com/objectbox/objectbox-python).
These language bindings currently serve as an example for this Dart implementation.
### Query and QueryBuilder

Basic querying can be done with e.g.:

```dart
// var store ...
// var box ...

box.putMany([Note(), Note(), Note()]);
box.put(Note.construct("Hello world!"));

final queryNullText = box.query(Note_.text.isNull()).build();

assert(queryNullText.count() == 3);

queryNullText.close(); // We have to manually close queries and query builders.
```

More complex queries can be constructed using `and/or` operators.
Also there is basic operator overloading support for `equal`, `greater`, `less`, `and` and `or`,
respectively `==`, `>`, `<`, `&`, `|`.

```dart
// final box ...

Internally, ObjectBox uses [FlatBuffers](https://google.github.io/flatbuffers/) to store objects.
There are two basic ways to make the conversion: generated binding code, or implicit FlatBuffers conversion.
The latter is used at the moment (helped us to get started quickly).
A future version will exchange that with code generation.
box.query(value.greaterThan(10).or(date.IsNull())).build();

// equivalent to

final overloaded = (value > 10) | date.IsNull();
box.query(overloaded as Condition).build(); // the cast is necessary due to the type analyzer
```

### Ordering

The results from a query can be ordered using the `order` method, e.g.

```dart
final q = box.query(Entity_.number > 0)
.order(Type_.number)
.build();

// ...

final qt = box.query(Entity_.text.notNull())
.order(Entity_.text, flags: OBXOrderFlag.DESCENDING | OBXOrderFlag.CASE_SENSITIVE)
.build();
```

Help wanted
-----------
ObjectBox for Dart is still in an early stage with limited feature set (compared to other languages).
To bring all these features to Dart, we're asking the community to help out. PRs are more than welcome!
The ObjectBox team will try its best to guide you and answer questions.

### Feedback
Also, please let us know your feedback by opening an issue:
for example, if you experience errors or if you have ideas for how to improve the API.
Thanks!

Changelog
See also
---------
[CHANGELOG.md](CHANGELOG.md)
* [Changelog](CHANGELOG.md)
* [Contribution guidelines](CONTRIBUTING.md)

License
-------
Expand Down
11 changes: 11 additions & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
include: package:pedantic/analysis_options.yaml

linter:
rules:
# additional rules used by pub.dev
- non_constant_identifier_names

analyzer:
exclude:
- example/**
- generator/** # needs to be checked separately because its a separate package
46 changes: 0 additions & 46 deletions bin/objectbox_model_generator/lib/src/code_chunks.dart

This file was deleted.

14 changes: 0 additions & 14 deletions bin/objectbox_model_generator/pubspec.yaml

This file was deleted.

This file was deleted.

Loading