mirror of https://github.com/AMT-Cheif/drift.git
use arrow functions and entry* naming for singletons
This commit is contained in:
parent
7f83898d00
commit
fb2423c28f
|
@ -102,9 +102,8 @@ If you want to make your query consumable as either a `Future` or a `Stream`,
|
|||
you can refine your return type using one of the `Selectable` abstract base classes;
|
||||
```dart
|
||||
// Exposes `get` and `watch`
|
||||
MultiSelectable<Todo> pageOfTodos(int page, {int pageSize = 10}) {
|
||||
return select(todos)..limit(pageSize, offset: page - 1);
|
||||
}
|
||||
MultiSelectable<Todo> pageOfTodos(int page, {int pageSize = 10}) =>
|
||||
select(todos)..limit(pageSize, offset: page);
|
||||
|
||||
// Exposes `getSingle` and `watchSingle`
|
||||
SingleSelectable<Todo> entryById(int id) =>
|
||||
|
|
|
@ -76,9 +76,8 @@ abstract class Query<T extends Table, D extends DataClass> extends Component {
|
|||
/// {@template moor_multi_selectable_example}
|
||||
/// ```dart
|
||||
/// /// Retrieve a page of [Todo]s.
|
||||
/// MultiSelectable<Todo> pageOfTodos(int page, {int pageSize = 10}) {
|
||||
/// return select(todos)..limit(pageSize, offset: page - 1);
|
||||
/// }
|
||||
/// MultiSelectable<Todo> pageOfTodos(int page, {int pageSize = 10}) =>
|
||||
/// select(todos)..limit(pageSize, offset: page);
|
||||
/// pageOfTodos(1).get();
|
||||
/// pageOfTodos(1).watch();
|
||||
/// ```
|
||||
|
|
Loading…
Reference in New Issue