GeezerVison is showing github.com — objectbox-rxjava: Add README. · jamestiotio/objectbox-java@35841c1
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboard +31Lines changed: 31 additions & 0 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +RxJava 2 APIs for ObjectBox |
| 2 | +=========================== |
| 3 | +While ObjectBox has [data observers and reactive extensions](https://docs.objectbox.io/data-observers-and-rx) built-in, |
| 4 | +this project adds RxJava 2 support. |
| 5 | + |
| 6 | +For general object changes, you can use `RxBoxStore` to create an `Observable`. |
| 7 | + |
| 8 | +`RxQuery` allows you to interact with ObjectBox `Query` objects using: |
| 9 | + * Flowable |
| 10 | + * Observable |
| 11 | + * Single |
| 12 | + |
| 13 | +For example to get query results and subscribe to future updates (Object changes will automatically emmit new data): |
| 14 | + |
| 15 | +```java |
| 16 | +Query query = box.query().build(); |
| 17 | +RxQuery.observable(query).subscribe(this); |
| 18 | +``` |
| 19 | + |
| 20 | +Adding the library to your project |
| 21 | +----------------- |
| 22 | +Grab via Gradle: |
| 23 | +```gradle |
| 24 | +compile 'io.objectbox:objectbox-rxjava:objectboxVersion' |
| 25 | +``` |
| 26 | + |
| 27 | +Links |
| 28 | +----- |
| 29 | +[Data Observers and Rx Documentation](https://docs.objectbox.io/data-observers-and-rx) |
| 30 | + |
| 31 | +[Note App example](https://github.com/objectbox/objectbox-examples/blob/master/objectbox-example/src/main/java/io/objectbox/example/ReactiveNoteActivity.java) |