// GENERATED CODE - DO NOT MODIFY BY HAND part of 'database.dart'; // ignore_for_file: type=lint class Chat extends Table with TableInfo { @override final GeneratedDatabase attachedDatabase; final String? _alias; Chat(this.attachedDatabase, [this._alias]); late final GeneratedColumn fileName = GeneratedColumn( 'file_name', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: true, $customConstraints: 'PRIMARY KEY NOT NULL'); late final GeneratedColumn title = GeneratedColumn( 'title', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: true, $customConstraints: 'NOT NULL'); late final GeneratedColumn content = GeneratedColumn( 'content', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: true, $customConstraints: 'NOT NULL'); @override List get $columns => [fileName, title, content]; @override String get aliasedName => _alias ?? actualTableName; @override String get actualTableName => $name; static const String $name = 'chat'; @override Set get $primaryKey => {fileName}; @override ChatData map(Map data, {String? tablePrefix}) { final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; return ChatData( fileName: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}file_name'])!, title: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}title'])!, content: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}content'])!, ); } @override Chat createAlias(String alias) { return Chat(attachedDatabase, alias); } @override bool get dontWriteConstraints => true; } class ChatData extends DataClass implements Insertable { final String fileName; final String title; final String content; const ChatData( {required this.fileName, required this.title, required this.content}); @override Map toColumns(bool nullToAbsent) { final map = {}; map['file_name'] = Variable(fileName); map['title'] = Variable(title); map['content'] = Variable(content); return map; } factory ChatData.fromJson(Map json, {ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return ChatData( fileName: serializer.fromJson(json['file_name']), title: serializer.fromJson(json['title']), content: serializer.fromJson(json['content']), ); } @override Map toJson({ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return { 'file_name': serializer.toJson(fileName), 'title': serializer.toJson(title), 'content': serializer.toJson(content), }; } ChatData copyWith({String? fileName, String? title, String? content}) => ChatData( fileName: fileName ?? this.fileName, title: title ?? this.title, content: content ?? this.content, ); ChatData copyWithCompanion(ChatCompanion data) { return ChatData( fileName: data.fileName.present ? data.fileName.value : this.fileName, title: data.title.present ? data.title.value : this.title, content: data.content.present ? data.content.value : this.content, ); } @override String toString() { return (StringBuffer('ChatData(') ..write('fileName: $fileName, ') ..write('title: $title, ') ..write('content: $content') ..write(')')) .toString(); } @override int get hashCode => Object.hash(fileName, title, content); @override bool operator ==(Object other) => identical(this, other) || (other is ChatData && other.fileName == this.fileName && other.title == this.title && other.content == this.content); } class ChatCompanion extends UpdateCompanion { final Value fileName; final Value title; final Value content; final Value rowid; const ChatCompanion({ this.fileName = const Value.absent(), this.title = const Value.absent(), this.content = const Value.absent(), this.rowid = const Value.absent(), }); ChatCompanion.insert({ required String fileName, required String title, required String content, this.rowid = const Value.absent(), }) : fileName = Value(fileName), title = Value(title), content = Value(content); static Insertable custom({ Expression? fileName, Expression? title, Expression? content, Expression? rowid, }) { return RawValuesInsertable({ if (fileName != null) 'file_name': fileName, if (title != null) 'title': title, if (content != null) 'content': content, if (rowid != null) 'rowid': rowid, }); } ChatCompanion copyWith( {Value? fileName, Value? title, Value? content, Value? rowid}) { return ChatCompanion( fileName: fileName ?? this.fileName, title: title ?? this.title, content: content ?? this.content, rowid: rowid ?? this.rowid, ); } @override Map toColumns(bool nullToAbsent) { final map = {}; if (fileName.present) { map['file_name'] = Variable(fileName.value); } if (title.present) { map['title'] = Variable(title.value); } if (content.present) { map['content'] = Variable(content.value); } if (rowid.present) { map['rowid'] = Variable(rowid.value); } return map; } @override String toString() { return (StringBuffer('ChatCompanion(') ..write('fileName: $fileName, ') ..write('title: $title, ') ..write('content: $content, ') ..write('rowid: $rowid') ..write(')')) .toString(); } } class ChatFts extends Table with TableInfo, VirtualTableInfo { @override final GeneratedDatabase attachedDatabase; final String? _alias; ChatFts(this.attachedDatabase, [this._alias]); late final GeneratedColumn title = GeneratedColumn( 'title', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: true, $customConstraints: ''); late final GeneratedColumn content = GeneratedColumn( 'content', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: true, $customConstraints: ''); @override List get $columns => [title, content]; @override String get aliasedName => _alias ?? actualTableName; @override String get actualTableName => $name; static const String $name = 'chat_fts'; @override Set get $primaryKey => const {}; @override ChatFt map(Map data, {String? tablePrefix}) { final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; return ChatFt( title: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}title'])!, content: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}content'])!, ); } @override ChatFts createAlias(String alias) { return ChatFts(attachedDatabase, alias); } @override bool get dontWriteConstraints => true; @override String get moduleAndArgs => 'fts5(title, content, content=chat, tokenize="trigram")'; } class ChatFt extends DataClass implements Insertable { final String title; final String content; const ChatFt({required this.title, required this.content}); @override Map toColumns(bool nullToAbsent) { final map = {}; map['title'] = Variable(title); map['content'] = Variable(content); return map; } factory ChatFt.fromJson(Map json, {ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return ChatFt( title: serializer.fromJson(json['title']), content: serializer.fromJson(json['content']), ); } @override Map toJson({ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return { 'title': serializer.toJson(title), 'content': serializer.toJson(content), }; } ChatFt copyWith({String? title, String? content}) => ChatFt( title: title ?? this.title, content: content ?? this.content, ); ChatFt copyWithCompanion(ChatFtsCompanion data) { return ChatFt( title: data.title.present ? data.title.value : this.title, content: data.content.present ? data.content.value : this.content, ); } @override String toString() { return (StringBuffer('ChatFt(') ..write('title: $title, ') ..write('content: $content') ..write(')')) .toString(); } @override int get hashCode => Object.hash(title, content); @override bool operator ==(Object other) => identical(this, other) || (other is ChatFt && other.title == this.title && other.content == this.content); } class ChatFtsCompanion extends UpdateCompanion { final Value title; final Value content; final Value rowid; const ChatFtsCompanion({ this.title = const Value.absent(), this.content = const Value.absent(), this.rowid = const Value.absent(), }); ChatFtsCompanion.insert({ required String title, required String content, this.rowid = const Value.absent(), }) : title = Value(title), content = Value(content); static Insertable custom({ Expression? title, Expression? content, Expression? rowid, }) { return RawValuesInsertable({ if (title != null) 'title': title, if (content != null) 'content': content, if (rowid != null) 'rowid': rowid, }); } ChatFtsCompanion copyWith( {Value? title, Value? content, Value? rowid}) { return ChatFtsCompanion( title: title ?? this.title, content: content ?? this.content, rowid: rowid ?? this.rowid, ); } @override Map toColumns(bool nullToAbsent) { final map = {}; if (title.present) { map['title'] = Variable(title.value); } if (content.present) { map['content'] = Variable(content.value); } if (rowid.present) { map['rowid'] = Variable(rowid.value); } return map; } @override String toString() { return (StringBuffer('ChatFtsCompanion(') ..write('title: $title, ') ..write('content: $content, ') ..write('rowid: $rowid') ..write(')')) .toString(); } } abstract class _$ChatSearchDatabase extends GeneratedDatabase { _$ChatSearchDatabase(QueryExecutor e) : super(e); $ChatSearchDatabaseManager get managers => $ChatSearchDatabaseManager(this); late final Chat chat = Chat(this); late final ChatFts chatFts = ChatFts(this); late final Trigger chatAfterInsert = Trigger( 'CREATE TRIGGER chat_after_insert AFTER INSERT ON chat BEGIN INSERT INTO chat_fts ("rowid", title, content) VALUES (new."rowid", new.title, new.content);END', 'chat_after_insert'); late final Trigger chatAfterDelete = Trigger( 'CREATE TRIGGER chat_after_delete AFTER DELETE ON chat BEGIN INSERT INTO chat_fts (chat_fts, "rowid", title, content) VALUES (\'delete\', old."rowid", old.title, old.content);END', 'chat_after_delete'); late final Trigger chatAfterUpdate = Trigger( 'CREATE TRIGGER chat_after_update AFTER UPDATE ON chat BEGIN INSERT INTO chat_fts (chat_fts, "rowid", title, content) VALUES (\'delete\', old."rowid", old.title, old.content);INSERT INTO chat_fts ("rowid", title, content) VALUES (new."rowid", new.title, new.content);END', 'chat_after_update'); late final SearchDao searchDao = SearchDao(this as ChatSearchDatabase); Selectable chatQuery( {required String beforeMatch, required String afterMatch, required String ellipsis, required int snippetLength, required String query}) { return customSelect( 'SELECT c.file_name, highlight(chat_fts, 0, ?1, ?2) AS title, snippet(chat_fts, 1, ?1, ?2, ?3, ?4) AS content_snippet FROM chat_fts(?5)AS fts INNER JOIN chat AS c ON c."rowid" = fts."rowid" ORDER BY RANK', variables: [ Variable(beforeMatch), Variable(afterMatch), Variable(ellipsis), Variable(snippetLength), Variable(query) ], readsFrom: { chat, chatFts, }).map((QueryRow row) => ChatQueryResult( fileName: row.read('file_name'), title: row.read('title'), contentSnippet: row.read('content_snippet'), )); } @override Iterable> get allTables => allSchemaEntities.whereType>(); @override List get allSchemaEntities => [chat, chatFts, chatAfterInsert, chatAfterDelete, chatAfterUpdate]; @override StreamQueryUpdateRules get streamUpdateRules => const StreamQueryUpdateRules( [ WritePropagation( on: TableUpdateQuery.onTableName('chat', limitUpdateKind: UpdateKind.insert), result: [ TableUpdate('chat_fts', kind: UpdateKind.insert), ], ), WritePropagation( on: TableUpdateQuery.onTableName('chat', limitUpdateKind: UpdateKind.delete), result: [ TableUpdate('chat_fts', kind: UpdateKind.insert), ], ), WritePropagation( on: TableUpdateQuery.onTableName('chat', limitUpdateKind: UpdateKind.update), result: [ TableUpdate('chat_fts', kind: UpdateKind.insert), ], ), ], ); } typedef $ChatCreateCompanionBuilder = ChatCompanion Function({ required String fileName, required String title, required String content, Value rowid, }); typedef $ChatUpdateCompanionBuilder = ChatCompanion Function({ Value fileName, Value title, Value content, Value rowid, }); class $ChatFilterComposer extends Composer<_$ChatSearchDatabase, Chat> { $ChatFilterComposer({ required super.$db, required super.$table, super.joinBuilder, super.$addJoinBuilderToRootComposer, super.$removeJoinBuilderFromRootComposer, }); ColumnFilters get fileName => $composableBuilder( column: $table.fileName, builder: (column) => ColumnFilters(column)); ColumnFilters get title => $composableBuilder( column: $table.title, builder: (column) => ColumnFilters(column)); ColumnFilters get content => $composableBuilder( column: $table.content, builder: (column) => ColumnFilters(column)); } class $ChatOrderingComposer extends Composer<_$ChatSearchDatabase, Chat> { $ChatOrderingComposer({ required super.$db, required super.$table, super.joinBuilder, super.$addJoinBuilderToRootComposer, super.$removeJoinBuilderFromRootComposer, }); ColumnOrderings get fileName => $composableBuilder( column: $table.fileName, builder: (column) => ColumnOrderings(column)); ColumnOrderings get title => $composableBuilder( column: $table.title, builder: (column) => ColumnOrderings(column)); ColumnOrderings get content => $composableBuilder( column: $table.content, builder: (column) => ColumnOrderings(column)); } class $ChatAnnotationComposer extends Composer<_$ChatSearchDatabase, Chat> { $ChatAnnotationComposer({ required super.$db, required super.$table, super.joinBuilder, super.$addJoinBuilderToRootComposer, super.$removeJoinBuilderFromRootComposer, }); GeneratedColumn get fileName => $composableBuilder(column: $table.fileName, builder: (column) => column); GeneratedColumn get title => $composableBuilder(column: $table.title, builder: (column) => column); GeneratedColumn get content => $composableBuilder(column: $table.content, builder: (column) => column); } class $ChatTableManager extends RootTableManager< _$ChatSearchDatabase, Chat, ChatData, $ChatFilterComposer, $ChatOrderingComposer, $ChatAnnotationComposer, $ChatCreateCompanionBuilder, $ChatUpdateCompanionBuilder, (ChatData, BaseReferences<_$ChatSearchDatabase, Chat, ChatData>), ChatData, PrefetchHooks Function()> { $ChatTableManager(_$ChatSearchDatabase db, Chat table) : super(TableManagerState( db: db, table: table, createFilteringComposer: () => $ChatFilterComposer($db: db, $table: table), createOrderingComposer: () => $ChatOrderingComposer($db: db, $table: table), createComputedFieldComposer: () => $ChatAnnotationComposer($db: db, $table: table), updateCompanionCallback: ({ Value fileName = const Value.absent(), Value title = const Value.absent(), Value content = const Value.absent(), Value rowid = const Value.absent(), }) => ChatCompanion( fileName: fileName, title: title, content: content, rowid: rowid, ), createCompanionCallback: ({ required String fileName, required String title, required String content, Value rowid = const Value.absent(), }) => ChatCompanion.insert( fileName: fileName, title: title, content: content, rowid: rowid, ), withReferenceMapper: (p0) => p0 .map((e) => (e.readTable(table), BaseReferences(db, table, e))) .toList(), prefetchHooksCallback: null, )); } typedef $ChatProcessedTableManager = ProcessedTableManager< _$ChatSearchDatabase, Chat, ChatData, $ChatFilterComposer, $ChatOrderingComposer, $ChatAnnotationComposer, $ChatCreateCompanionBuilder, $ChatUpdateCompanionBuilder, (ChatData, BaseReferences<_$ChatSearchDatabase, Chat, ChatData>), ChatData, PrefetchHooks Function()>; typedef $ChatFtsCreateCompanionBuilder = ChatFtsCompanion Function({ required String title, required String content, Value rowid, }); typedef $ChatFtsUpdateCompanionBuilder = ChatFtsCompanion Function({ Value title, Value content, Value rowid, }); class $ChatFtsFilterComposer extends Composer<_$ChatSearchDatabase, ChatFts> { $ChatFtsFilterComposer({ required super.$db, required super.$table, super.joinBuilder, super.$addJoinBuilderToRootComposer, super.$removeJoinBuilderFromRootComposer, }); ColumnFilters get title => $composableBuilder( column: $table.title, builder: (column) => ColumnFilters(column)); ColumnFilters get content => $composableBuilder( column: $table.content, builder: (column) => ColumnFilters(column)); } class $ChatFtsOrderingComposer extends Composer<_$ChatSearchDatabase, ChatFts> { $ChatFtsOrderingComposer({ required super.$db, required super.$table, super.joinBuilder, super.$addJoinBuilderToRootComposer, super.$removeJoinBuilderFromRootComposer, }); ColumnOrderings get title => $composableBuilder( column: $table.title, builder: (column) => ColumnOrderings(column)); ColumnOrderings get content => $composableBuilder( column: $table.content, builder: (column) => ColumnOrderings(column)); } class $ChatFtsAnnotationComposer extends Composer<_$ChatSearchDatabase, ChatFts> { $ChatFtsAnnotationComposer({ required super.$db, required super.$table, super.joinBuilder, super.$addJoinBuilderToRootComposer, super.$removeJoinBuilderFromRootComposer, }); GeneratedColumn get title => $composableBuilder(column: $table.title, builder: (column) => column); GeneratedColumn get content => $composableBuilder(column: $table.content, builder: (column) => column); } class $ChatFtsTableManager extends RootTableManager< _$ChatSearchDatabase, ChatFts, ChatFt, $ChatFtsFilterComposer, $ChatFtsOrderingComposer, $ChatFtsAnnotationComposer, $ChatFtsCreateCompanionBuilder, $ChatFtsUpdateCompanionBuilder, (ChatFt, BaseReferences<_$ChatSearchDatabase, ChatFts, ChatFt>), ChatFt, PrefetchHooks Function()> { $ChatFtsTableManager(_$ChatSearchDatabase db, ChatFts table) : super(TableManagerState( db: db, table: table, createFilteringComposer: () => $ChatFtsFilterComposer($db: db, $table: table), createOrderingComposer: () => $ChatFtsOrderingComposer($db: db, $table: table), createComputedFieldComposer: () => $ChatFtsAnnotationComposer($db: db, $table: table), updateCompanionCallback: ({ Value title = const Value.absent(), Value content = const Value.absent(), Value rowid = const Value.absent(), }) => ChatFtsCompanion( title: title, content: content, rowid: rowid, ), createCompanionCallback: ({ required String title, required String content, Value rowid = const Value.absent(), }) => ChatFtsCompanion.insert( title: title, content: content, rowid: rowid, ), withReferenceMapper: (p0) => p0 .map((e) => (e.readTable(table), BaseReferences(db, table, e))) .toList(), prefetchHooksCallback: null, )); } typedef $ChatFtsProcessedTableManager = ProcessedTableManager< _$ChatSearchDatabase, ChatFts, ChatFt, $ChatFtsFilterComposer, $ChatFtsOrderingComposer, $ChatFtsAnnotationComposer, $ChatFtsCreateCompanionBuilder, $ChatFtsUpdateCompanionBuilder, (ChatFt, BaseReferences<_$ChatSearchDatabase, ChatFts, ChatFt>), ChatFt, PrefetchHooks Function()>; class $ChatSearchDatabaseManager { final _$ChatSearchDatabase _db; $ChatSearchDatabaseManager(this._db); $ChatTableManager get chat => $ChatTableManager(_db, _db.chat); $ChatFtsTableManager get chatFts => $ChatFtsTableManager(_db, _db.chatFts); } class ChatQueryResult { final String fileName; final String title; final String contentSnippet; ChatQueryResult({ required this.fileName, required this.title, required this.contentSnippet, }); }