use arrow functions and entry* naming for singletons

This commit is contained in:
micimize 2021-04-04 11:25:15 -05:00
parent 7f83898d00
commit fb2423c28f
No known key found for this signature in database
GPG Key ID: 88F30E5F5F5D64A1
2 changed files with 4 additions and 6 deletions

View File

@ -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) =>

View File

@ -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();
/// ```