You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: usage2/rxjavasupport.md
+5-5Lines changed: 5 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -1,14 +1,14 @@
1
1
# RXJavaSupport
2
2
3
-
RXJava support in DBFlow is an _incubating_ feature and likely to change over time. We support RXJava3 only and have made the extensions + DBFlow compatibility almost identical - save for the changes and where it makes sense in each version.
3
+
RXJava support in DBFlow is an _incubating_ feature and likely to change over time. We support both RX1 and RX2 and have made the extensions + DBFlow compatibility almost identical - save for the changes and where it makes sense in each version.
4
4
5
-
Currently it supports
5
+
Currently it supports
6
6
7
-
1. Any `ModelQueriable` can be wrapped in a `Single`, `Maybe`, or `Flowable`\(to continuously observe changes\).
7
+
1. Any `ModelQueriable` can be wrapped in a `Single`, `Maybe`, or `Flowable`\(to continuously observe changes\).
8
8
9
-
2. Single + `List` model `save()`, `insert()`, `update()`, and `delete()`.
9
+
2. Single + `List` model `save()`, `insert()`, `update()`, and `delete()`.
10
10
11
-
3. Streaming a set of results from a query
11
+
3. Streaming a set of results from a query
12
12
13
13
4. Observing on table changes for specific `ModelQueriable` and providing ability to query from that set repeatedly as needed.
Copy file name to clipboardExpand all lines: usage2/usage/databases.md
+38-16Lines changed: 38 additions & 16 deletions
Original file line number
Diff line number
Diff line change
@@ -34,11 +34,11 @@ val db = FlowManager.getDatabase(AppDatabase::class.java)
34
34
To specify a custom **name** to the database, in previous versions of DBFlow \(< 4.1.0\), you had to specify it in the `@Database` annotation. As of 5.0 now you pass it in the initialization of the `FlowManager`:
This will close the open DB, reopen the DB, and replace previous `DatabaseConfig` with this new one. Ensure that you persist the changes to the `DatabaseConfig` somewhere as next time app is launched and DBFlow is initialized, the new config would get overwritten.
@@ -57,11 +57,11 @@ This will close the open DB, reopen the DB, and replace previous `DatabaseConfig
57
57
As with **name**, in previous versions of DBFlow \(< 5.0\), you specified `inMemory` in the `@Database` annotation. Starting with 5.0 that is replaced with:
This will allow you to use in-memory databases in your tests, while writing to disk in your apps. Also if your device the app is running on is low on memory, you could also swap the DB into memory by calling `reopen(DatabaseConfig)` as explained above.
@@ -122,10 +122,32 @@ class CustomFlowSQliteOpenHelper(context: Contect, databaseDefinition: DatabaseD
As of 5.0.0-alpha2, you can configure a database via a DSL rather than use the `FlowConfig.Builder` , `DatabaseConfig.Builder`, and `TableConfig.Builder`. This allows more readable, expressive syntax.
135
+
136
+
**Initializing DBFlow:**
137
+
138
+
```kotlin
139
+
FlowManager.init(context) {
140
+
// this is FlowConfig.Builder
141
+
database<AppDatabase> {
142
+
// this is DatabaseConfig.Builder
143
+
table<MyTable> {
144
+
// this is TableConfig.Builder
145
+
}
146
+
}
147
+
// other module dbs
148
+
databaseHolder<MyGeneratedDatabaseHolder>()
149
+
}
130
150
```
131
151
152
+
By utilizing Kotlin DSL, this code is more straightforward, concise, and readable.
0 commit comments