Merge branch 'master' into develop

# Conflicts:
#	moor_generator/pubspec.yaml
This commit is contained in:
Simon Binder 2020-06-28 17:34:00 +02:00
commit 3923b815fd
No known key found for this signature in database
GPG Key ID: 7891917E4147B8C0
8 changed files with 15 additions and 10 deletions

View File

@ -35,11 +35,15 @@ Future<List<Animal>> findAnimalsByLegs(int legCount) {
```
## Boolean algebra
You can nest boolean expressions by using the `&`, `!` operators and the `not` method
You can nest boolean expressions by using the `&`, `|` operators and the `not` method
exposed by moor:
```dart
// find all animals that aren't mammals and have 4 legs
select(animals)..where((a) => a.isMammal.not() & a.amountOfLegs.equals(4))
select(animals)..where((a) => a.isMammal.not() & a.amountOfLegs.equals(4));
// find all animals that are mammals or have 2 legs
select(animals)..where((a) => a.isMammal | a.amountOfLegs.equals(2));
```
## Arithmetic

View File

@ -61,7 +61,7 @@ Future<void> writeShoppingCart(CartWithItems entry) {
final cart = entry.cart;
// first, we write the shopping cart
await into(shoppingCarts).insert(cart, orReplace: true);
await into(shoppingCarts).insert(cart, mode: InsertMode.replace);
// we replace the entries of the cart, so first delete the old ones
await (delete(shoppingCartEntries)

View File

@ -20,7 +20,7 @@ class MyDatabase extends _$MyDatabase {
MyDatabase() : super(WebDatabase('app'));
```
Moor web is built on top of the [sql.js](https://github.com/kripken/sql.js/) library, which you need to include:
Moor web is built on top of the [sql.js](https://github.com/sql-js/sql.js/) library, which you need to include:
```html
<!doctype html>
<html lang="en">
@ -32,7 +32,7 @@ Moor web is built on top of the [sql.js](https://github.com/kripken/sql.js/) lib
<body></body>
</html>
```
You can grab the latest version of `sql-wasm.js` and `sql-wasm.wasm` [here](https://github.com/kripken/sql.js/tree/master/dist)
You can grab the latest version of `sql-wasm.js` and `sql-wasm.wasm` [here](https://github.com/sql-js/sql.js/releases)
and copy them into your `web` folder.
A full example that works on the web (and all other platforms) is available
@ -74,7 +74,7 @@ SharedDatabase constructDb() {
You can see all queries sent from moor to the underlying database engine by enabling the `logStatements`
parameter on the `WebDatabase` - they will appear in the console.
When you have assertions enabled (e.g. in debug mode), moor will expose the underlying
[database](http://kripken.github.io/sql.js/documentation/#http://kripken.github.io/sql.js/documentation/class/Database.html)
[database](http://sql-js.github.io/sql.js/documentation/#http://sql-js.github.io/sql.js/documentation/class/Database.html)
object via `window.db`. If you need to quickly run a query to check the state of the database, you can use
`db.exec(sql)`.
If you need to delete your databases, there stored using local storage. You can clear all your data with `localStorage.clear()`.

View File

@ -21,7 +21,7 @@ part 'database.g.dart';
include: {'tables.moor'},
)
class MoorDb extends _$MoorDb {
MoorDb() : super(FlutterQueryExecutor.inDatabaseFolder('app.db'));
MoorDb() : super(FlutterQueryExecutor.inDatabaseFolder(path: 'app.db'));
@override
int get schemaVersion => 1;

View File

@ -10,7 +10,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 on top
of database libraries like [sqflite](https://pub.dev/packages/sqflite) or [sql.js](https://github.com/kripken/sql.js/)
of database libraries like [sqflite](https://pub.dev/packages/sqflite) or [sql.js](https://github.com/sql-js/sql.js/)
and provides additional features, like:
- __Type safety__: Instead of writing sql queries manually and parsing the `List<Map<String, dynamic>>` that they

View File

@ -1,4 +1,4 @@
/// A version of moor that runs on the web by using [sql.js](https://github.com/kripken/sql.js)
/// A version of moor that runs on the web by using [sql.js](https://github.com/sql-js/sql.js)
/// You manually need to include that library into your website to use the
/// web version of moor. See [the documentation](https://moor.simonbinder.eu/web)
/// for a more detailed instruction.

View File

@ -35,7 +35,7 @@ class _Bin2String extends Converter<Uint8List, String> {
const _Bin2String();
// There is a browser limit on the amount of chars one can give to
// String.fromCharCodes https://github.com/kripken/sql.js/wiki/Persisting-a-Modified-Database#save-a-database-to-a-string
// String.fromCharCodes https://github.com/sql-js/sql.js/wiki/Persisting-a-Modified-Database#save-a-database-to-a-string
static const int _chunkSize = 0xffff;
@override

View File

@ -1,3 +1,4 @@
@Tags(['analyzer'])
import 'package:moor_generator/moor_generator.dart';
import 'package:moor_generator/src/analyzer/errors.dart';
import 'package:moor_generator/src/analyzer/runner/results.dart';