mirror of https://github.com/AMT-Cheif/drift.git
Expand docs on VmDatabase
This commit is contained in:
parent
76155358b4
commit
02d949d5b9
|
@ -15,7 +15,8 @@ import 'moor_ffi_functions.dart';
|
||||||
/// implementations.
|
/// implementations.
|
||||||
typedef DatabaseSetup = void Function(Database database);
|
typedef DatabaseSetup = void Function(Database database);
|
||||||
|
|
||||||
/// A moor database that runs on the Dart VM.
|
/// A moor database implementation based on `dart:ffi`, running directly in a
|
||||||
|
/// Dart VM or an AOT compiled Dart/Flutter application.
|
||||||
class VmDatabase extends DelegatedDatabase {
|
class VmDatabase extends DelegatedDatabase {
|
||||||
VmDatabase._(DatabaseDelegate delegate, bool logStatements)
|
VmDatabase._(DatabaseDelegate delegate, bool logStatements)
|
||||||
: super(delegate, isSequential: true, logStatements: logStatements);
|
: super(delegate, isSequential: true, logStatements: logStatements);
|
||||||
|
@ -51,6 +52,10 @@ class VmDatabase extends DelegatedDatabase {
|
||||||
/// calling [QueryExecutor.close] on the returned [VmDatabase] will also
|
/// calling [QueryExecutor.close] on the returned [VmDatabase] will also
|
||||||
/// [Database.dispose] the [database] passed to this constructor.
|
/// [Database.dispose] the [database] passed to this constructor.
|
||||||
///
|
///
|
||||||
|
/// Using [VmDatabase.opened] may be useful when you want to use the same
|
||||||
|
/// underlying [Database] in multiple moor connections. Moor uses this
|
||||||
|
/// internally when running [integration tests for migrations](https://moor.simonbinder.eu/docs/advanced-features/migrations/#verifying-migrations).
|
||||||
|
///
|
||||||
/// {@macro moor_vm_database_factory}
|
/// {@macro moor_vm_database_factory}
|
||||||
factory VmDatabase.opened(Database database,
|
factory VmDatabase.opened(Database database,
|
||||||
{bool logStatements = false,
|
{bool logStatements = false,
|
||||||
|
|
|
@ -75,7 +75,7 @@ class VerifierImplementation implements SchemaVerifier {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<DatabaseConnection> startAt(int version) {
|
Future<DatabaseConnection> startAt(int version) {
|
||||||
return schemaAt(version).then((schema) => schema.connection);
|
return schemaAt(version).then((schema) => schema.newConnection());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue