Merge branch 'master' into develop

This commit is contained in:
Simon Binder 2020-02-01 22:09:47 +01:00
commit 01d48fa0d3
No known key found for this signature in database
GPG Key ID: 7891917E4147B8C0
4 changed files with 24 additions and 3 deletions

View File

@ -37,7 +37,7 @@ class TodoDb extends _$TodoDb {
With the database class ready, let's open it on a background isolate
```dart
import 'package:moor/isolates.dart';
import 'package:moor/isolate.dart';
// This needs to be a top-level method because it's run on a background isolate
DatabaseConnection _backgroundConnection() {
@ -171,4 +171,4 @@ Internally, moor uses the following model to implement this api:
The client acts as a moor backend, which means that all queries are built on the client isolate. The
raw sql string and parameters are then sent to the server isolate, which will enqueue the operation
and execute it eventually. Implementing the isolate commands at a low level allows users to re-use
all their code used without the isolate api.
all their code used without the isolate api.

View File

@ -1,3 +1,8 @@
## 2.1.0
- Expose the underlying database from sqflite in `FlutterQueryExecutor`.
This exists only to make migrations to moor easier.
## 2.0.0
See the changelog of [moor](https://pub.dev/packages/moor#-changelog-tab-) for details,
or check out an overview of new features [here](https://moor.simonbinder.eu/v2])

View File

@ -188,4 +188,20 @@ class FlutterQueryExecutor extends DelegatedDatabase {
_SqfliteDelegate(true, path,
singleInstance: singleInstance, creator: creator),
logStatements: logStatements);
/// The underlying sqflite [s.Database] object used by moor to send queries.
///
/// Using the sqflite database can cause unexpected behavior in moor. For
/// instance, stream queries won't update for updates sent to the [s.Database]
/// directly.
/// For this reason, projects shouldn't use this getter unless they absolutely
/// need to. The database is exposed to make migrating from sqflite to moor
/// easier.
///
/// Note that this returns null until the moor database has been opened.
/// A moor database is opened lazily when the first query runs.
s.Database get sqfliteDb {
final sqfliteDelegate = delegate as _SqfliteDelegate;
return sqfliteDelegate.db;
}
}

View File

@ -1,6 +1,6 @@
name: moor_flutter
description: Flutter implementation of moor, a safe and reactive persistence library for Dart applications
version: 2.0.0
version: 2.1.0
repository: https://github.com/simolus3/moor
homepage: https://moor.simonbinder.eu/
issue_tracker: https://github.com/simolus3/moor/issues