mirror of https://github.com/AMT-Cheif/drift.git
Update relationships example to use extensions
This commit is contained in:
parent
70259c8f83
commit
2f40e38484
|
@ -129,7 +129,7 @@ type of transformation, RxDart's `switchMap` comes in handy:
|
||||||
```dart
|
```dart
|
||||||
Stream<List<CartWithItems>> watchAllCarts() {
|
Stream<List<CartWithItems>> watchAllCarts() {
|
||||||
// start by watching all carts
|
// start by watching all carts
|
||||||
final cartStream = Observable(select(shoppingCarts).watch());
|
final cartStream = select(shoppingCarts).watch();
|
||||||
|
|
||||||
return cartStream.switchMap((carts) {
|
return cartStream.switchMap((carts) {
|
||||||
// this method is called whenever the list of carts changes. For each
|
// this method is called whenever the list of carts changes. For each
|
||||||
|
@ -146,7 +146,7 @@ Stream<List<CartWithItems>> watchAllCarts() {
|
||||||
buyableItems.id.equalsExp(shoppingCartEntries.item),
|
buyableItems.id.equalsExp(shoppingCartEntries.item),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
)..where(isIn(shoppingCartEntries.shoppingCart, ids));
|
)..where(shoppingCartEntries.shoppingCart.isIn(ids));
|
||||||
|
|
||||||
return entryQuery.watch().map((rows) {
|
return entryQuery.watch().map((rows) {
|
||||||
// Store the list of entries for each cart, again using maps for faster
|
// Store the list of entries for each cart, again using maps for faster
|
||||||
|
|
Loading…
Reference in New Issue