From 87ae54bad01fa70c6901770b96d1eaca2ea4b05b Mon Sep 17 00:00:00 2001 From: Christopher Boumenot Date: Wed, 22 Apr 2020 19:42:55 -0700 Subject: [PATCH 1/2] typos --- docs/content/en/docs/Advanced Features/expressions.md | 2 +- docs/content/en/docs/Advanced Features/isolates.md | 4 ++-- docs/content/en/docs/Advanced Features/joins.md | 2 +- docs/content/en/docs/Advanced Features/migrations.md | 2 +- docs/content/en/docs/CLI.md | 4 ++-- docs/content/en/docs/Examples/relationships.md | 2 +- docs/content/en/docs/Getting started/_index.md | 2 +- docs/content/en/docs/Getting started/advanced_dart_tables.md | 2 +- docs/content/en/docs/Other engines/encryption.md | 2 +- docs/content/en/docs/Other engines/vm.md | 2 +- docs/content/en/docs/Using SQL/custom_queries.md | 4 ++-- docs/content/en/docs/Using SQL/moor_files.md | 4 ++-- docs/content/en/docs/_index.md | 2 +- docs/content/en/docs/testing.md | 2 +- docs/content/en/docs/transactions.md | 4 ++-- 15 files changed, 20 insertions(+), 20 deletions(-) diff --git a/docs/content/en/docs/Advanced Features/expressions.md b/docs/content/en/docs/Advanced Features/expressions.md index 78bde563..efbf6dda 100644 --- a/docs/content/en/docs/Advanced Features/expressions.md +++ b/docs/content/en/docs/Advanced Features/expressions.md @@ -71,7 +71,7 @@ fields from that date: select(users)..where((u) => u.birthDate.year.isLessThan(1950)) ``` -The individual fileds like `year`, `month` and so on are expressions themselves. This means +The individual fields like `year`, `month` and so on are expressions themselves. This means that you can use operators and comparisons on them. To obtain the current date or the current time as an expression, use the `currentDate` and `currentDateAndTime` constants provided by moor. diff --git a/docs/content/en/docs/Advanced Features/isolates.md b/docs/content/en/docs/Advanced Features/isolates.md index 6d597427..b3026172 100644 --- a/docs/content/en/docs/Advanced Features/isolates.md +++ b/docs/content/en/docs/Advanced Features/isolates.md @@ -92,7 +92,7 @@ Future _createMoorIsolate() async { } void _startBackground(_IsolateStartRequest request) { - // this is the entrypoint from the background isolate! Let's create + // this is the entry point from the background isolate! Let's create // the database from the path we received final executor = VmDatabase(File(request.targetPath)); // we're using MoorIsolate.inCurrent here as this method already runs on a @@ -105,7 +105,7 @@ void _startBackground(_IsolateStartRequest request) { request.sendMoorIsolate.send(moorIsolate); } -// used to bundle the SendPort and the target path, since isolate entrypoint +// used to bundle the SendPort and the target path, since isolate entry point // functions can only take one parameter. class _IsolateStartRequest { final SendPort sendMoorIsolate; diff --git a/docs/content/en/docs/Advanced Features/joins.md b/docs/content/en/docs/Advanced Features/joins.md index 62b8913c..38fe6403 100644 --- a/docs/content/en/docs/Advanced Features/joins.md +++ b/docs/content/en/docs/Advanced Features/joins.md @@ -158,7 +158,7 @@ comes from multiple rows. Common questions include - what's the average length of a todo entry? What these queries have in common is that data from multiple rows needs to be combined into a single -row. In sql, this can be achieved with "aggregate functins", for which moor has +row. In sql, this can be achieved with "aggregate functions", for which moor has [builtin support]({{< relref "expressions.md#aggregate" >}}). _Additional info_: A good tutorial for group by in sql is available [here](https://www.sqlitetutorial.net/sqlite-group-by/). diff --git a/docs/content/en/docs/Advanced Features/migrations.md b/docs/content/en/docs/Advanced Features/migrations.md index 9a115e28..31ea5bef 100644 --- a/docs/content/en/docs/Advanced Features/migrations.md +++ b/docs/content/en/docs/Advanced Features/migrations.md @@ -87,5 +87,5 @@ yet. You can just delete your apps' data and reinstall the app - the database wi will be created again. Please note that uninstalling is not enough sometimes - Android might have backed up the database file and will re-create it when installing the app again. -You can also delete and re-create all tables everytime your app is opened, see [this comment](https://github.com/simolus3/moor/issues/188#issuecomment-542682912) +You can also delete and re-create all tables every time your app is opened, see [this comment](https://github.com/simolus3/moor/issues/188#issuecomment-542682912) on how that can be achieved. \ No newline at end of file diff --git a/docs/content/en/docs/CLI.md b/docs/content/en/docs/CLI.md index 1e129850..b5d66681 100644 --- a/docs/content/en/docs/CLI.md +++ b/docs/content/en/docs/CLI.md @@ -53,7 +53,7 @@ INFO: test/fake_db.dart has moor databases or daos: TodoDb, SomeDao ### Export This subcommand expects two paths, a Dart file and a target. The Dart file should contain -excactly one class annotated with `@UseMoor`. Running the following command will export +exactly one class annotated with `@UseMoor`. Running the following command will export the database schema to json. ``` @@ -68,4 +68,4 @@ The generated file (`schema.json` in this case) contains information about all - `@create`-queries from included moor files - dependecies thereof -The schema format is still work-in-progress and might change in the future. \ No newline at end of file +The schema format is still a work-in-progress and might change in the future. diff --git a/docs/content/en/docs/Examples/relationships.md b/docs/content/en/docs/Examples/relationships.md index 1dd7c394..d7a607b1 100644 --- a/docs/content/en/docs/Examples/relationships.md +++ b/docs/content/en/docs/Examples/relationships.md @@ -87,7 +87,7 @@ Future createEmptyCart() async { ``` ## Selecting a cart -As our `CartWithItems` class consists of multiple compontents that are separated in the +As our `CartWithItems` class consists of multiple components that are separated in the database (information about the cart, and information about the added items), we'll have to merge two streams together. The `rxdart` library helps here by providing the `combineLatest2` method, allowing us to write diff --git a/docs/content/en/docs/Getting started/_index.md b/docs/content/en/docs/Getting started/_index.md index 9691f7e5..fcdad908 100644 --- a/docs/content/en/docs/Getting started/_index.md +++ b/docs/content/en/docs/Getting started/_index.md @@ -83,7 +83,7 @@ examples. Otherwise, the generator won't be able to know what's going on. ## Generating the code Moor integrates with Dart's `build` system, so you can generate all the code needed with `flutter packages pub run build_runner build`. If you want to continuously rebuild the generated code -whever you change your code, run `flutter packages pub run build_runner watch` instead. +where you change your code, run `flutter packages pub run build_runner watch` instead. After running either command once, the moor generator will have created a class for your database and data classes for your entities. To use it, change the `MyDatabase` class as follows: diff --git a/docs/content/en/docs/Getting started/advanced_dart_tables.md b/docs/content/en/docs/Getting started/advanced_dart_tables.md index 47ca0aa9..fea6dc1c 100644 --- a/docs/content/en/docs/Getting started/advanced_dart_tables.md +++ b/docs/content/en/docs/Getting started/advanced_dart_tables.md @@ -93,4 +93,4 @@ class Users extends Table { Don't know when to use which? Prefer to use `withDefault` when the default value is constant, or something simple like `currentDate`. For more complicated values, like a randomly generated id, you need to use `clientDefault`. Internally, `withDefault` writes the default value into the `CREATE TABLE` statement. This -can be more efficient, but doesn't suppport dynamic values. \ No newline at end of file +can be more efficient, but doesn't support dynamic values. \ No newline at end of file diff --git a/docs/content/en/docs/Other engines/encryption.md b/docs/content/en/docs/Other engines/encryption.md index eb5dc382..ac2c7df0 100644 --- a/docs/content/en/docs/Other engines/encryption.md +++ b/docs/content/en/docs/Other engines/encryption.md @@ -26,4 +26,4 @@ Finally, you can replace `FlutterQueryExecutor` with an `EncryptedExecutor`. Some extra steps may have to be taken in your project so that SQLCipher works correctly. For example, the ProGuard configuration on Android for apps built for release. -[Read instructions](https://pub.dev/packages/sqflite_sqlcipher) (Usage and instrallation instructions of the package can be ignored, as that is handled internally by `moor`) +[Read instructions](https://pub.dev/packages/sqflite_sqlcipher) (Usage and installation instructions of the package can be ignored, as that is handled internally by `moor`) diff --git a/docs/content/en/docs/Other engines/vm.md b/docs/content/en/docs/Other engines/vm.md index fde84735..30953b7d 100644 --- a/docs/content/en/docs/Other engines/vm.md +++ b/docs/content/en/docs/Other engines/vm.md @@ -103,7 +103,7 @@ LazyDatabase(() async { ## Used compile options on Android Note: Android is the only platform where moor_ffi will compile sqlite. The sqlite3 library from the system -is used on all other platforms. The choosen options help reduce binary size by removing features not used by +is used on all other platforms. The chosen options help reduce binary size by removing features not used by moor. Important options are marked in bold. - We use the `-O3` performance option diff --git a/docs/content/en/docs/Using SQL/custom_queries.md b/docs/content/en/docs/Using SQL/custom_queries.md index 13768b3b..304c5a0b 100644 --- a/docs/content/en/docs/Using SQL/custom_queries.md +++ b/docs/content/en/docs/Using SQL/custom_queries.md @@ -13,10 +13,10 @@ be supported, moor files will get better tooling support in the future and we re migrate. See [their api]({{%relref "moor_files.md"%}}) for details. {{% /alert %}} -Altough moor includes a fluent api that can be used to model most statements, advanced +Although moor includes a fluent api that can be used to model most statements, advanced features like `GROUP BY` statements or window functions are not yet supported. You can use these features with custom statements. You don't have to miss out on other benefits -moor brings, though: Moor helps you parse the result rows and qustom queries also +moor brings, though: Moor helps you parse the result rows and custom queries also support auto-updating streams. ## Statements with a generated api diff --git a/docs/content/en/docs/Using SQL/moor_files.md b/docs/content/en/docs/Using SQL/moor_files.md index dbd0ec99..0b37d472 100644 --- a/docs/content/en/docs/Using SQL/moor_files.md +++ b/docs/content/en/docs/Using SQL/moor_files.md @@ -75,13 +75,13 @@ what we got: `todos` and the description of the associated category. ## Variables -We support regular variables (`?`), explictly indexed variables (`?123`) +We support regular variables (`?`), explicitly indexed variables (`?123`) and colon-named variables (`:id`). We don't support variables declared with @ or $. The compiler will attempt to infer the variable's type by looking at its context. This lets moor generate typesafe apis for your queries, the variables will be written as parameters to your method. -When it's ambigous, the analyzer might be unable to resolve the type of +When it's ambiguous, the analyzer might be unable to resolve the type of a variable. For those scenarios, you can also denote the explicit type of a variable: ```sql diff --git a/docs/content/en/docs/_index.md b/docs/content/en/docs/_index.md index 383387d3..2d8113a1 100755 --- a/docs/content/en/docs/_index.md +++ b/docs/content/en/docs/_index.md @@ -9,7 +9,7 @@ description: Welcome to the moor documentation. This site shows you what moor ca --- ## So what's moor? -Moor is a reactive persistence library for Dart and Flutter applications. It's built ontop +Moor is a reactive persistence library for Dart and Flutter applications. It's built on top of database libraries like [sqflite](https://pub.dev/packages/sqflite) or [sql.js](https://github.com/kripken/sql.js/) and provides additional features, like: diff --git a/docs/content/en/docs/testing.md b/docs/content/en/docs/testing.md index a060c1b3..a6326b00 100644 --- a/docs/content/en/docs/testing.md +++ b/docs/content/en/docs/testing.md @@ -18,7 +18,7 @@ dev_dependencies: For this guide, we're going to test a very simple database that stores user names. The only important change from a regular moor database is the constructor: We make the `QueryExecutor` argument explicit instead of having a no-args constructor that passes -a `FlutterQueryExector` to the superclass. +a `FlutterQueryExecutor` to the superclass. ```dart import 'package:moor/moor.dart'; diff --git a/docs/content/en/docs/transactions.md b/docs/content/en/docs/transactions.md index d39f622b..38ac1df0 100644 --- a/docs/content/en/docs/transactions.md +++ b/docs/content/en/docs/transactions.md @@ -44,12 +44,12 @@ they behave. Query streams that have been created outside a transaction work nicely together with updates made in a transaction: All changes to tables will only be reported after the transaction completes. Updates inside a transaction don't have an immediate effect on -streams, so your data will always be consistent and there aren't any uneccessary updates. +streams, so your data will always be consistent and there aren't any unnecessary updates. With streams created _inside_ a `transaction` block (or a nested call in there), it's a different story. Notably, they -- reflect on changes made in the transaction immediatly +- reflect on changes made in the transaction immediately - complete when the transaction completes This behavior is useful if you're collapsing streams inside a transaction, for instance by From 2c4d17af82f5e96e34be64f406c55f55e21a5ce6 Mon Sep 17 00:00:00 2001 From: Christopher Boumenot Date: Wed, 22 Apr 2020 19:55:13 -0700 Subject: [PATCH 2/2] add limit example --- docs/content/en/docs/Getting started/writing_queries.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/content/en/docs/Getting started/writing_queries.md b/docs/content/en/docs/Getting started/writing_queries.md index f0ed3201..aa9a1cdc 100644 --- a/docs/content/en/docs/Getting started/writing_queries.md +++ b/docs/content/en/docs/Getting started/writing_queries.md @@ -47,6 +47,12 @@ details on expressions, see [this guide]({{< relref "expressions.md" >}}). ### Limit You can limit the amount of results returned by calling `limit` on queries. The method accepts the amount of rows to return and an optional offset. +```dart +Future> limitTodos(int limit, {int offset}) { + return (select(todos)..limit(limit, offset: offset)).get(); +} +``` + ### Ordering You can use the `orderBy` method on the select statement. It expects a list of functions that extract the individual ordering terms from the table.