@@ -1,6 +1,5 @@
|
||||
import 'package:drift/drift.dart';
|
||||
import 'package:stream_chat/stream_chat.dart';
|
||||
|
||||
import 'package:stream_chat_persistence/src/converter/converter.dart';
|
||||
import 'package:stream_chat_persistence/src/dao/dao.dart';
|
||||
import 'package:stream_chat_persistence/src/entity/entity.dart';
|
||||
@@ -37,18 +36,12 @@ part 'drift_chat_database.g.dart';
|
||||
],
|
||||
)
|
||||
class DriftChatDatabase extends _$DriftChatDatabase {
|
||||
/// Creates a new moor chat database instance
|
||||
/// Creates a new drift chat database instance
|
||||
DriftChatDatabase(
|
||||
this._userId,
|
||||
QueryExecutor executor,
|
||||
) : super(executor);
|
||||
|
||||
/// Instantiate a new database instance
|
||||
DriftChatDatabase.connect(
|
||||
this._userId,
|
||||
DatabaseConnection connection,
|
||||
) : super.connect(connection);
|
||||
|
||||
final String _userId;
|
||||
|
||||
/// User id to which the database is connected
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -23,7 +23,7 @@ class SharedDB {
|
||||
}) async {
|
||||
final dbName = 'db_$userId';
|
||||
if (connectionMode == ConnectionMode.background) {
|
||||
return DriftChatDatabase.connect(
|
||||
return DriftChatDatabase(
|
||||
userId,
|
||||
DatabaseConnection.delayed(Future(() async {
|
||||
final isolate = await _createMoorIsolate(
|
||||
@@ -34,6 +34,7 @@ class SharedDB {
|
||||
})),
|
||||
);
|
||||
}
|
||||
|
||||
return DriftChatDatabase(
|
||||
userId,
|
||||
LazyDatabase(
|
||||
@@ -68,7 +69,7 @@ class SharedDB {
|
||||
logStatements: request.logStatements,
|
||||
));
|
||||
final moorIsolate = DriftIsolate.inCurrent(
|
||||
() => DatabaseConnection.fromExecutor(executor),
|
||||
() => DatabaseConnection(executor),
|
||||
);
|
||||
request.sendMoorIsolate.send(moorIsolate);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user