Skip to content
This repository was archived by the owner on Aug 17, 2020. It is now read-only.

Commit 1b8d7bb

Browse files
committed
Merge pull request #92 from square/jw/readmeh
Update README for Schedulers, SQLDelight.
2 parents d874ea9 + 9ba6590 commit 1b8d7bb

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

README.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,16 @@ Create a `SqlBrite` instance which is an adapter for the library functionality.
1515
SqlBrite sqlBrite = SqlBrite.create();
1616
```
1717

18-
Pass a `SQLiteOpenHelper` instance to create a `BriteDatabase`.
18+
Pass a `SQLiteOpenHelper` instance and a `Scheduler` to create a `BriteDatabase`.
1919

2020
```java
21-
BriteDatabase db = sqlBrite.wrapDatabaseHelper(openHelper);
21+
BriteDatabase db = sqlBrite.wrapDatabaseHelper(openHelper, Schedulers.io());
2222
```
2323

24+
A `Scheduler` is required for a few reasons, but the most important is that query notifications can
25+
trigger on the thread of your choice. The query can then be run without blocking the main thread or
26+
the thread which caused the trigger.
27+
2428
The `BriteDatabase.createQuery` method is similar to `SQLiteDatabase.rawQuery` except it takes an
2529
additional parameter of table(s) on which to listen for changes. Subscribe to the returned
2630
`Observable<Query>` which will immediately notify with a `Query` to run.
@@ -136,7 +140,7 @@ of updates to tables such that you can update queries as soon as data changes.
136140
This library is not an ORM. It is not a type-safe query mechanism. It won't serialize the same POJOs
137141
you use for Gson. It's not going to perform database migrations for you.
138142

139-
A day may come when some of those features are added, but it is not this day.
143+
Some of these features are offered by [SQLDelight][sqldelight] which can be used with SQLBrite.
140144

141145

142146

@@ -173,3 +177,4 @@ License
173177

174178

175179
[snap]: https://oss.sonatype.org/content/repositories/snapshots/
180+
[sqldelight]: https://github.com/square/sqldelight/

0 commit comments

Comments
 (0)