forked from mongodb/docs-realm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix RealmSet test and update snippets
- Loading branch information
1 parent
09a957e
commit 1f9d25e
Showing
8 changed files
with
77 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 4 additions & 4 deletions
8
source/examples/generated/kotlin/SchemaTest.snippet.add-all-to-realm-set.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
source/examples/generated/kotlin/SchemaTest.snippet.add-item-to-realm-set.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 6 additions & 5 deletions
11
source/examples/generated/kotlin/SchemaTest.snippet.react-to-changes-from-the-set.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
val kermitFrog = realm.query<Frog>("name = 'Kermit'").first().find() | ||
val job = CoroutineScope(Dispatchers.Default).launch { | ||
kermitFrog?.favoriteSnacks | ||
?.asFlow() | ||
?.collect() { | ||
val kermitFrog = realm.query<Frog>("name = $0", "Kermit").find().first() | ||
|
||
val job = launch(Dispatchers.Default) { | ||
kermitFrog.favoriteSnacks | ||
.asFlow() | ||
.collect { | ||
// Listen for changes to the RealmSet | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
source/examples/generated/kotlin/SchemaTest.snippet.remove-item-from-set.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
val fliesSnack = realm.query<Snack>("name = 'flies'").first().find() | ||
val fliesSnack = query<Snack>("name == $0", "flies").first().find() | ||
|
||
set.remove(fliesSnack) |
4 changes: 3 additions & 1 deletion
4
source/examples/generated/kotlin/SchemaTest.snippet.remove-multiple-items-from-set.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
set.removeAll(set) | ||
val allSnacks = findLatest(myFrog)!!.favoriteSnacks | ||
|
||
set.removeAll(allSnacks) |
2 changes: 1 addition & 1 deletion
2
source/examples/generated/kotlin/SchemaTest.snippet.set-contains-multiple-items.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
val containsAllSnacks = set.containsAll(set) | ||
Log.v("Does Kermit eat crickets, earthworms, and wax worms?: $containsAllSnacks") // true | ||
Log.v("Does Kermit eat crickets, earthworms, and waxworms?: $containsAllSnacks") // true |