// // GENERATED CODE - DO NOT MODIFY BY HAND // // part of 'hx_database.dart'; // // // ************************************************************************** // // FloorGenerator // // ************************************************************************** // // // ignore: avoid_classes_with_only_static_members // import 'package:floor/floor.dart'; // // class $FloorHxDatabase { // /// Creates a database builder for a persistent database. // /// Once a database is built, you should keep a reference to it and re-use it. // static _$HxDatabaseBuilder databaseBuilder(String name) => // _$HxDatabaseBuilder(name); // // /// Creates a database builder for an in memory database. // /// Information stored in an in memory database disappears when the process is killed. // /// Once a database is built, you should keep a reference to it and re-use it. // static _$HxDatabaseBuilder inMemoryDatabaseBuilder() => // _$HxDatabaseBuilder(null); // } // // class _$HxDatabaseBuilder { // _$HxDatabaseBuilder(this.name); // // final String name; // // final List _migrations = []; // // Callback _callback; // // /// Adds migrations to the builder. // _$HxDatabaseBuilder addMigrations(List migrations) { // _migrations.addAll(migrations); // return this; // } // // /// Adds a database [Callback] to the builder. // _$HxDatabaseBuilder addCallback(Callback callback) { // _callback = callback; // return this; // } // // /// Creates the database and initializes it. // Future build() async { // final path = name != null // ? await sqfliteDatabaseFactory.getDatabasePath(name) // : ':memory:'; // final database = _$HxDatabase(); // database.database = await database.open( // path, // _migrations, // _callback, // ); // return database; // } // } // // class _$HxDatabase extends HxDatabase { // _$HxDatabase([StreamController listener]) { // changeListener = listener ?? StreamController.broadcast(); // } // // MessageDao _messageDaoInstance; // // Future open( // String path, // List migrations, [ // Callback callback, // ]) async { // final databaseOptions = sqflite.OpenDatabaseOptions( // version: 1, // onConfigure: (database) async { // await database.execute('PRAGMA foreign_keys = ON'); // await callback?.onConfigure?.call(database); // }, // onOpen: (database) async { // await callback?.onOpen?.call(database); // }, // onUpgrade: (database, startVersion, endVersion) async { // await MigrationAdapter.runMigrations( // database, startVersion, endVersion, migrations); // // await callback?.onUpgrade?.call(database, startVersion, endVersion); // }, // onCreate: (database, version) async { // await database.execute( // 'CREATE TABLE IF NOT EXISTS `Message` (`id` INTEGER, `fromId` INTEGER, `toId` INTEGER, `content` TEXT, `attach` TEXT, `msgType` INTEGER, `time` INTEGER, `state` INTEGER, `isDelete` INTEGER, PRIMARY KEY (`id`))'); // // await callback?.onCreate?.call(database, version); // }, // ); // return sqfliteDatabaseFactory.openDatabase(path, options: databaseOptions); // } // // @override // MessageDao get messageDao { // return _messageDaoInstance ??= _$MessageDao(database, changeListener); // } // } // // class _$MessageDao extends MessageDao { // _$MessageDao( // this.database, // this.changeListener, // ) : _queryAdapter = QueryAdapter(database, changeListener), // _messageInsertionAdapter = InsertionAdapter( // database, // 'Message', // (Message item) => item.toJson(), // changeListener); // // final sqflite.DatabaseExecutor database; // // final StreamController changeListener; // // final QueryAdapter _queryAdapter; // // final InsertionAdapter _messageInsertionAdapter; // // @override // Stream> findMessageByToId(int toId) { // return _queryAdapter.queryListStream( // 'SELECT * FROM Message WHERE toId = ?1', // mapper: (Map row) => Message.fromJson(row), // arguments: [toId], // queryableName: 'Message', // isView: false); // } // // @override // Future> findMessageByGroup(int userId) { // debugPrint("findMessageByGroup: $userId"); // return _queryAdapter.queryList( // 'SELECT * FROM Message WHERE toId = ?1 OR fromId = ?2 GROUP BY toId,fromId ORDER BY time DESC', // mapper: (Map row) => Message.fromJson(row), // arguments: [userId, userId]); // } // // @override // Future insertMessage(Message message) async { // await _messageInsertionAdapter.insert(message, OnConflictStrategy.abort); // } // }