feat: add quotations from marked text, with citations and sharing
This commit is contained in:
parent
0e2027c9e2
commit
e6e84fdc01
25 changed files with 1558 additions and 4 deletions
|
|
@ -148,6 +148,21 @@ class SiteCertificates extends Table {
|
|||
Set<Column> get primaryKey => {host, port};
|
||||
}
|
||||
|
||||
/// A stretch of text the reader marked on a page and kept, together with the
|
||||
/// page it came from. The author is carried only when the page's metadata
|
||||
/// said one, and the site's title when the reader's subscriptions know the
|
||||
/// site the page belongs to. The column is named [Quotations.quote] because
|
||||
/// `text` is the drift builder the declaration would otherwise call.
|
||||
class Quotations extends Table {
|
||||
IntColumn get id => integer().autoIncrement()();
|
||||
TextColumn get pageUrl => text()();
|
||||
TextColumn get pageTitle => text().nullable()();
|
||||
TextColumn get author => text().nullable()();
|
||||
TextColumn get siteTitle => text().nullable()();
|
||||
TextColumn get quote => text()();
|
||||
DateTimeColumn get createdAt => dateTime().withDefault(currentDateAndTime)();
|
||||
}
|
||||
|
||||
@DriftDatabase(tables: [
|
||||
HistoryItems,
|
||||
Bookmarks,
|
||||
|
|
@ -160,6 +175,7 @@ class SiteCertificates extends Table {
|
|||
ClientCertificates,
|
||||
SiteCertificates,
|
||||
FirstStart,
|
||||
Quotations,
|
||||
])
|
||||
class MewsDatabase extends _$MewsDatabase {
|
||||
MewsDatabase() : super(_open());
|
||||
|
|
@ -168,7 +184,7 @@ class MewsDatabase extends _$MewsDatabase {
|
|||
MewsDatabase.test(super.executor);
|
||||
|
||||
@override
|
||||
int get schemaVersion => 6;
|
||||
int get schemaVersion => 8;
|
||||
|
||||
@override
|
||||
MigrationStrategy get migration => MigrationStrategy(
|
||||
|
|
@ -197,6 +213,12 @@ class MewsDatabase extends _$MewsDatabase {
|
|||
if (from < 6) {
|
||||
await m.createTable(firstStart);
|
||||
}
|
||||
if (from < 7) {
|
||||
await m.createTable(quotations);
|
||||
}
|
||||
if (from < 8) {
|
||||
await m.addColumn(quotations, quotations.siteTitle);
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
|
|
@ -717,6 +739,87 @@ class MewsDatabase extends _$MewsDatabase {
|
|||
return [for (final row in rows) '${row.host}:${row.port}'];
|
||||
}
|
||||
|
||||
// Quotations --------------------------------------------------------------
|
||||
|
||||
/// Keeps a marked stretch of text together with the page it came from,
|
||||
/// and with the site's title when the reader's subscriptions know the site
|
||||
/// the page belongs to: the site whose posts listed the page, or the page
|
||||
/// itself when it is the subscribed one.
|
||||
Future<void> addQuotation({
|
||||
required String quote,
|
||||
required String pageUrl,
|
||||
String? pageTitle,
|
||||
String? author,
|
||||
}) async {
|
||||
into(quotations).insert(QuotationsCompanion.insert(
|
||||
quote: quote,
|
||||
pageUrl: pageUrl,
|
||||
pageTitle: Value(pageTitle),
|
||||
author: Value(author),
|
||||
siteTitle: Value(await siteTitleOf(pageUrl)),
|
||||
));
|
||||
}
|
||||
|
||||
/// The title of the site [pageUrl] belongs to, or null when the reader's
|
||||
/// subscriptions do not know it. A page the site lists as a post takes the
|
||||
/// subscribing site's title; a subscribed page is its own site.
|
||||
Future<String?> siteTitleOf(String pageUrl) async {
|
||||
final site = alias(subscriptions, 'site');
|
||||
final throughPosts = await ((select(feedEntries).join([
|
||||
leftOuterJoin(site, site.url.equalsExp(feedEntries.siteUrl)),
|
||||
]))
|
||||
..where(feedEntries.url.equals(pageUrl)))
|
||||
.get();
|
||||
if (throughPosts.isNotEmpty) {
|
||||
return throughPosts.first.readTableOrNull(site)?.title;
|
||||
}
|
||||
final own =
|
||||
await (select(subscriptions)..where((r) => r.url.equals(pageUrl)))
|
||||
.getSingleOrNull();
|
||||
return own?.title;
|
||||
}
|
||||
|
||||
Future<void> removeQuotation(int id) =>
|
||||
(delete(quotations)..where((q) => q.id.equals(id))).go();
|
||||
|
||||
/// One quotation, so an action address can act on it.
|
||||
Future<Quotation?> quotationById(int id) =>
|
||||
(select(quotations)..where((q) => q.id.equals(id))).getSingleOrNull();
|
||||
|
||||
/// Every kept quotation, for the quotations page. [query] narrows by the
|
||||
/// quoted text, the page's title, its author or its address.
|
||||
Future<List<Quotation>> quotationsList({
|
||||
QuotationSort sort = QuotationSort.date,
|
||||
String? query,
|
||||
}) async {
|
||||
final statement = select(quotations)
|
||||
..orderBy(switch (sort) {
|
||||
QuotationSort.date => [
|
||||
// Tiebreak quotations saved within the same clock tick.
|
||||
(r) => OrderingTerm.desc(r.createdAt),
|
||||
(r) => OrderingTerm.asc(r.id),
|
||||
],
|
||||
QuotationSort.page => [
|
||||
// A page without a title sorts under its address, so the order
|
||||
// never depends on a null.
|
||||
(r) => OrderingTerm.asc(coalesce([r.pageTitle, r.pageUrl])),
|
||||
(r) => OrderingTerm.desc(r.createdAt),
|
||||
],
|
||||
});
|
||||
final filter = _search(
|
||||
[quotations.quote, quotations.pageTitle, quotations.author, quotations.pageUrl],
|
||||
query);
|
||||
if (filter != null) statement.where((_) => filter);
|
||||
return statement.get();
|
||||
}
|
||||
|
||||
/// How many quotations are held, for the hub.
|
||||
Future<int> countQuotations() async {
|
||||
final total = quotations.id.count();
|
||||
final query = selectOnly(quotations)..addColumns([total]);
|
||||
return (await query.getSingle()).read(total) ?? 0;
|
||||
}
|
||||
|
||||
/// Binds a certificate to a host, replacing whatever was bound before.
|
||||
Future<void> bindCertificate(String host, int port, int certificateId) =>
|
||||
into(siteCertificates).insert(
|
||||
|
|
@ -743,6 +846,17 @@ enum EntrySort {
|
|||
};
|
||||
}
|
||||
|
||||
/// How the quotations page is ordered.
|
||||
enum QuotationSort {
|
||||
date,
|
||||
page;
|
||||
|
||||
/// Reads the order from an address, falling back to the default rather than
|
||||
/// refusing a value the reader may have typed.
|
||||
static QuotationSort parse(String? name) =>
|
||||
name == 'page' ? QuotationSort.page : QuotationSort.date;
|
||||
}
|
||||
|
||||
/// How widely one tag is used.
|
||||
class TagUse {
|
||||
const TagUse({required this.bookmarks, required this.sites});
|
||||
|
|
|
|||
|
|
@ -3579,6 +3579,450 @@ class FirstStartCompanion extends UpdateCompanion<FirstStartData> {
|
|||
}
|
||||
}
|
||||
|
||||
class $QuotationsTable extends Quotations
|
||||
with TableInfo<$QuotationsTable, Quotation> {
|
||||
@override
|
||||
final GeneratedDatabase attachedDatabase;
|
||||
final String? _alias;
|
||||
$QuotationsTable(this.attachedDatabase, [this._alias]);
|
||||
static const VerificationMeta _idMeta = const VerificationMeta('id');
|
||||
@override
|
||||
late final GeneratedColumn<int> id = GeneratedColumn<int>(
|
||||
'id',
|
||||
aliasedName,
|
||||
false,
|
||||
hasAutoIncrement: true,
|
||||
type: DriftSqlType.int,
|
||||
requiredDuringInsert: false,
|
||||
defaultConstraints: GeneratedColumn.constraintIsAlways(
|
||||
'PRIMARY KEY AUTOINCREMENT',
|
||||
),
|
||||
);
|
||||
static const VerificationMeta _pageUrlMeta = const VerificationMeta(
|
||||
'pageUrl',
|
||||
);
|
||||
@override
|
||||
late final GeneratedColumn<String> pageUrl = GeneratedColumn<String>(
|
||||
'page_url',
|
||||
aliasedName,
|
||||
false,
|
||||
type: DriftSqlType.string,
|
||||
requiredDuringInsert: true,
|
||||
);
|
||||
static const VerificationMeta _pageTitleMeta = const VerificationMeta(
|
||||
'pageTitle',
|
||||
);
|
||||
@override
|
||||
late final GeneratedColumn<String> pageTitle = GeneratedColumn<String>(
|
||||
'page_title',
|
||||
aliasedName,
|
||||
true,
|
||||
type: DriftSqlType.string,
|
||||
requiredDuringInsert: false,
|
||||
);
|
||||
static const VerificationMeta _authorMeta = const VerificationMeta('author');
|
||||
@override
|
||||
late final GeneratedColumn<String> author = GeneratedColumn<String>(
|
||||
'author',
|
||||
aliasedName,
|
||||
true,
|
||||
type: DriftSqlType.string,
|
||||
requiredDuringInsert: false,
|
||||
);
|
||||
static const VerificationMeta _siteTitleMeta = const VerificationMeta(
|
||||
'siteTitle',
|
||||
);
|
||||
@override
|
||||
late final GeneratedColumn<String> siteTitle = GeneratedColumn<String>(
|
||||
'site_title',
|
||||
aliasedName,
|
||||
true,
|
||||
type: DriftSqlType.string,
|
||||
requiredDuringInsert: false,
|
||||
);
|
||||
static const VerificationMeta _quoteMeta = const VerificationMeta('quote');
|
||||
@override
|
||||
late final GeneratedColumn<String> quote = GeneratedColumn<String>(
|
||||
'quote',
|
||||
aliasedName,
|
||||
false,
|
||||
type: DriftSqlType.string,
|
||||
requiredDuringInsert: true,
|
||||
);
|
||||
static const VerificationMeta _createdAtMeta = const VerificationMeta(
|
||||
'createdAt',
|
||||
);
|
||||
@override
|
||||
late final GeneratedColumn<DateTime> createdAt = GeneratedColumn<DateTime>(
|
||||
'created_at',
|
||||
aliasedName,
|
||||
false,
|
||||
type: DriftSqlType.dateTime,
|
||||
requiredDuringInsert: false,
|
||||
defaultValue: currentDateAndTime,
|
||||
);
|
||||
@override
|
||||
List<GeneratedColumn> get $columns => [
|
||||
id,
|
||||
pageUrl,
|
||||
pageTitle,
|
||||
author,
|
||||
siteTitle,
|
||||
quote,
|
||||
createdAt,
|
||||
];
|
||||
@override
|
||||
String get aliasedName => _alias ?? actualTableName;
|
||||
@override
|
||||
String get actualTableName => $name;
|
||||
static const String $name = 'quotations';
|
||||
@override
|
||||
VerificationContext validateIntegrity(
|
||||
Insertable<Quotation> instance, {
|
||||
bool isInserting = false,
|
||||
}) {
|
||||
final context = VerificationContext();
|
||||
final data = instance.toColumns(true);
|
||||
if (data.containsKey('id')) {
|
||||
context.handle(_idMeta, id.isAcceptableOrUnknown(data['id']!, _idMeta));
|
||||
}
|
||||
if (data.containsKey('page_url')) {
|
||||
context.handle(
|
||||
_pageUrlMeta,
|
||||
pageUrl.isAcceptableOrUnknown(data['page_url']!, _pageUrlMeta),
|
||||
);
|
||||
} else if (isInserting) {
|
||||
context.missing(_pageUrlMeta);
|
||||
}
|
||||
if (data.containsKey('page_title')) {
|
||||
context.handle(
|
||||
_pageTitleMeta,
|
||||
pageTitle.isAcceptableOrUnknown(data['page_title']!, _pageTitleMeta),
|
||||
);
|
||||
}
|
||||
if (data.containsKey('author')) {
|
||||
context.handle(
|
||||
_authorMeta,
|
||||
author.isAcceptableOrUnknown(data['author']!, _authorMeta),
|
||||
);
|
||||
}
|
||||
if (data.containsKey('site_title')) {
|
||||
context.handle(
|
||||
_siteTitleMeta,
|
||||
siteTitle.isAcceptableOrUnknown(data['site_title']!, _siteTitleMeta),
|
||||
);
|
||||
}
|
||||
if (data.containsKey('quote')) {
|
||||
context.handle(
|
||||
_quoteMeta,
|
||||
quote.isAcceptableOrUnknown(data['quote']!, _quoteMeta),
|
||||
);
|
||||
} else if (isInserting) {
|
||||
context.missing(_quoteMeta);
|
||||
}
|
||||
if (data.containsKey('created_at')) {
|
||||
context.handle(
|
||||
_createdAtMeta,
|
||||
createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta),
|
||||
);
|
||||
}
|
||||
return context;
|
||||
}
|
||||
|
||||
@override
|
||||
Set<GeneratedColumn> get $primaryKey => {id};
|
||||
@override
|
||||
Quotation map(Map<String, dynamic> data, {String? tablePrefix}) {
|
||||
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
||||
return Quotation(
|
||||
id: attachedDatabase.typeMapping.read(
|
||||
DriftSqlType.int,
|
||||
data['${effectivePrefix}id'],
|
||||
)!,
|
||||
pageUrl: attachedDatabase.typeMapping.read(
|
||||
DriftSqlType.string,
|
||||
data['${effectivePrefix}page_url'],
|
||||
)!,
|
||||
pageTitle: attachedDatabase.typeMapping.read(
|
||||
DriftSqlType.string,
|
||||
data['${effectivePrefix}page_title'],
|
||||
),
|
||||
author: attachedDatabase.typeMapping.read(
|
||||
DriftSqlType.string,
|
||||
data['${effectivePrefix}author'],
|
||||
),
|
||||
siteTitle: attachedDatabase.typeMapping.read(
|
||||
DriftSqlType.string,
|
||||
data['${effectivePrefix}site_title'],
|
||||
),
|
||||
quote: attachedDatabase.typeMapping.read(
|
||||
DriftSqlType.string,
|
||||
data['${effectivePrefix}quote'],
|
||||
)!,
|
||||
createdAt: attachedDatabase.typeMapping.read(
|
||||
DriftSqlType.dateTime,
|
||||
data['${effectivePrefix}created_at'],
|
||||
)!,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
$QuotationsTable createAlias(String alias) {
|
||||
return $QuotationsTable(attachedDatabase, alias);
|
||||
}
|
||||
}
|
||||
|
||||
class Quotation extends DataClass implements Insertable<Quotation> {
|
||||
final int id;
|
||||
final String pageUrl;
|
||||
final String? pageTitle;
|
||||
final String? author;
|
||||
final String? siteTitle;
|
||||
final String quote;
|
||||
final DateTime createdAt;
|
||||
const Quotation({
|
||||
required this.id,
|
||||
required this.pageUrl,
|
||||
this.pageTitle,
|
||||
this.author,
|
||||
this.siteTitle,
|
||||
required this.quote,
|
||||
required this.createdAt,
|
||||
});
|
||||
@override
|
||||
Map<String, Expression> toColumns(bool nullToAbsent) {
|
||||
final map = <String, Expression>{};
|
||||
map['id'] = Variable<int>(id);
|
||||
map['page_url'] = Variable<String>(pageUrl);
|
||||
if (!nullToAbsent || pageTitle != null) {
|
||||
map['page_title'] = Variable<String>(pageTitle);
|
||||
}
|
||||
if (!nullToAbsent || author != null) {
|
||||
map['author'] = Variable<String>(author);
|
||||
}
|
||||
if (!nullToAbsent || siteTitle != null) {
|
||||
map['site_title'] = Variable<String>(siteTitle);
|
||||
}
|
||||
map['quote'] = Variable<String>(quote);
|
||||
map['created_at'] = Variable<DateTime>(createdAt);
|
||||
return map;
|
||||
}
|
||||
|
||||
QuotationsCompanion toCompanion(bool nullToAbsent) {
|
||||
return QuotationsCompanion(
|
||||
id: Value(id),
|
||||
pageUrl: Value(pageUrl),
|
||||
pageTitle: pageTitle == null && nullToAbsent
|
||||
? const Value.absent()
|
||||
: Value(pageTitle),
|
||||
author: author == null && nullToAbsent
|
||||
? const Value.absent()
|
||||
: Value(author),
|
||||
siteTitle: siteTitle == null && nullToAbsent
|
||||
? const Value.absent()
|
||||
: Value(siteTitle),
|
||||
quote: Value(quote),
|
||||
createdAt: Value(createdAt),
|
||||
);
|
||||
}
|
||||
|
||||
factory Quotation.fromJson(
|
||||
Map<String, dynamic> json, {
|
||||
ValueSerializer? serializer,
|
||||
}) {
|
||||
serializer ??= driftRuntimeOptions.defaultSerializer;
|
||||
return Quotation(
|
||||
id: serializer.fromJson<int>(json['id']),
|
||||
pageUrl: serializer.fromJson<String>(json['pageUrl']),
|
||||
pageTitle: serializer.fromJson<String?>(json['pageTitle']),
|
||||
author: serializer.fromJson<String?>(json['author']),
|
||||
siteTitle: serializer.fromJson<String?>(json['siteTitle']),
|
||||
quote: serializer.fromJson<String>(json['quote']),
|
||||
createdAt: serializer.fromJson<DateTime>(json['createdAt']),
|
||||
);
|
||||
}
|
||||
@override
|
||||
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
|
||||
serializer ??= driftRuntimeOptions.defaultSerializer;
|
||||
return <String, dynamic>{
|
||||
'id': serializer.toJson<int>(id),
|
||||
'pageUrl': serializer.toJson<String>(pageUrl),
|
||||
'pageTitle': serializer.toJson<String?>(pageTitle),
|
||||
'author': serializer.toJson<String?>(author),
|
||||
'siteTitle': serializer.toJson<String?>(siteTitle),
|
||||
'quote': serializer.toJson<String>(quote),
|
||||
'createdAt': serializer.toJson<DateTime>(createdAt),
|
||||
};
|
||||
}
|
||||
|
||||
Quotation copyWith({
|
||||
int? id,
|
||||
String? pageUrl,
|
||||
Value<String?> pageTitle = const Value.absent(),
|
||||
Value<String?> author = const Value.absent(),
|
||||
Value<String?> siteTitle = const Value.absent(),
|
||||
String? quote,
|
||||
DateTime? createdAt,
|
||||
}) => Quotation(
|
||||
id: id ?? this.id,
|
||||
pageUrl: pageUrl ?? this.pageUrl,
|
||||
pageTitle: pageTitle.present ? pageTitle.value : this.pageTitle,
|
||||
author: author.present ? author.value : this.author,
|
||||
siteTitle: siteTitle.present ? siteTitle.value : this.siteTitle,
|
||||
quote: quote ?? this.quote,
|
||||
createdAt: createdAt ?? this.createdAt,
|
||||
);
|
||||
Quotation copyWithCompanion(QuotationsCompanion data) {
|
||||
return Quotation(
|
||||
id: data.id.present ? data.id.value : this.id,
|
||||
pageUrl: data.pageUrl.present ? data.pageUrl.value : this.pageUrl,
|
||||
pageTitle: data.pageTitle.present ? data.pageTitle.value : this.pageTitle,
|
||||
author: data.author.present ? data.author.value : this.author,
|
||||
siteTitle: data.siteTitle.present ? data.siteTitle.value : this.siteTitle,
|
||||
quote: data.quote.present ? data.quote.value : this.quote,
|
||||
createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return (StringBuffer('Quotation(')
|
||||
..write('id: $id, ')
|
||||
..write('pageUrl: $pageUrl, ')
|
||||
..write('pageTitle: $pageTitle, ')
|
||||
..write('author: $author, ')
|
||||
..write('siteTitle: $siteTitle, ')
|
||||
..write('quote: $quote, ')
|
||||
..write('createdAt: $createdAt')
|
||||
..write(')'))
|
||||
.toString();
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
Object.hash(id, pageUrl, pageTitle, author, siteTitle, quote, createdAt);
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
(other is Quotation &&
|
||||
other.id == this.id &&
|
||||
other.pageUrl == this.pageUrl &&
|
||||
other.pageTitle == this.pageTitle &&
|
||||
other.author == this.author &&
|
||||
other.siteTitle == this.siteTitle &&
|
||||
other.quote == this.quote &&
|
||||
other.createdAt == this.createdAt);
|
||||
}
|
||||
|
||||
class QuotationsCompanion extends UpdateCompanion<Quotation> {
|
||||
final Value<int> id;
|
||||
final Value<String> pageUrl;
|
||||
final Value<String?> pageTitle;
|
||||
final Value<String?> author;
|
||||
final Value<String?> siteTitle;
|
||||
final Value<String> quote;
|
||||
final Value<DateTime> createdAt;
|
||||
const QuotationsCompanion({
|
||||
this.id = const Value.absent(),
|
||||
this.pageUrl = const Value.absent(),
|
||||
this.pageTitle = const Value.absent(),
|
||||
this.author = const Value.absent(),
|
||||
this.siteTitle = const Value.absent(),
|
||||
this.quote = const Value.absent(),
|
||||
this.createdAt = const Value.absent(),
|
||||
});
|
||||
QuotationsCompanion.insert({
|
||||
this.id = const Value.absent(),
|
||||
required String pageUrl,
|
||||
this.pageTitle = const Value.absent(),
|
||||
this.author = const Value.absent(),
|
||||
this.siteTitle = const Value.absent(),
|
||||
required String quote,
|
||||
this.createdAt = const Value.absent(),
|
||||
}) : pageUrl = Value(pageUrl),
|
||||
quote = Value(quote);
|
||||
static Insertable<Quotation> custom({
|
||||
Expression<int>? id,
|
||||
Expression<String>? pageUrl,
|
||||
Expression<String>? pageTitle,
|
||||
Expression<String>? author,
|
||||
Expression<String>? siteTitle,
|
||||
Expression<String>? quote,
|
||||
Expression<DateTime>? createdAt,
|
||||
}) {
|
||||
return RawValuesInsertable({
|
||||
if (id != null) 'id': id,
|
||||
if (pageUrl != null) 'page_url': pageUrl,
|
||||
if (pageTitle != null) 'page_title': pageTitle,
|
||||
if (author != null) 'author': author,
|
||||
if (siteTitle != null) 'site_title': siteTitle,
|
||||
if (quote != null) 'quote': quote,
|
||||
if (createdAt != null) 'created_at': createdAt,
|
||||
});
|
||||
}
|
||||
|
||||
QuotationsCompanion copyWith({
|
||||
Value<int>? id,
|
||||
Value<String>? pageUrl,
|
||||
Value<String?>? pageTitle,
|
||||
Value<String?>? author,
|
||||
Value<String?>? siteTitle,
|
||||
Value<String>? quote,
|
||||
Value<DateTime>? createdAt,
|
||||
}) {
|
||||
return QuotationsCompanion(
|
||||
id: id ?? this.id,
|
||||
pageUrl: pageUrl ?? this.pageUrl,
|
||||
pageTitle: pageTitle ?? this.pageTitle,
|
||||
author: author ?? this.author,
|
||||
siteTitle: siteTitle ?? this.siteTitle,
|
||||
quote: quote ?? this.quote,
|
||||
createdAt: createdAt ?? this.createdAt,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Map<String, Expression> toColumns(bool nullToAbsent) {
|
||||
final map = <String, Expression>{};
|
||||
if (id.present) {
|
||||
map['id'] = Variable<int>(id.value);
|
||||
}
|
||||
if (pageUrl.present) {
|
||||
map['page_url'] = Variable<String>(pageUrl.value);
|
||||
}
|
||||
if (pageTitle.present) {
|
||||
map['page_title'] = Variable<String>(pageTitle.value);
|
||||
}
|
||||
if (author.present) {
|
||||
map['author'] = Variable<String>(author.value);
|
||||
}
|
||||
if (siteTitle.present) {
|
||||
map['site_title'] = Variable<String>(siteTitle.value);
|
||||
}
|
||||
if (quote.present) {
|
||||
map['quote'] = Variable<String>(quote.value);
|
||||
}
|
||||
if (createdAt.present) {
|
||||
map['created_at'] = Variable<DateTime>(createdAt.value);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return (StringBuffer('QuotationsCompanion(')
|
||||
..write('id: $id, ')
|
||||
..write('pageUrl: $pageUrl, ')
|
||||
..write('pageTitle: $pageTitle, ')
|
||||
..write('author: $author, ')
|
||||
..write('siteTitle: $siteTitle, ')
|
||||
..write('quote: $quote, ')
|
||||
..write('createdAt: $createdAt')
|
||||
..write(')'))
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _$MewsDatabase extends GeneratedDatabase {
|
||||
_$MewsDatabase(QueryExecutor e) : super(e);
|
||||
$MewsDatabaseManager get managers => $MewsDatabaseManager(this);
|
||||
|
|
@ -3596,6 +4040,7 @@ abstract class _$MewsDatabase extends GeneratedDatabase {
|
|||
this,
|
||||
);
|
||||
late final $FirstStartTable firstStart = $FirstStartTable(this);
|
||||
late final $QuotationsTable quotations = $QuotationsTable(this);
|
||||
late final Index historyItemsUrl = Index(
|
||||
'history_items_url',
|
||||
'CREATE INDEX history_items_url ON history_items (url)',
|
||||
|
|
@ -3616,6 +4061,7 @@ abstract class _$MewsDatabase extends GeneratedDatabase {
|
|||
clientCertificates,
|
||||
siteCertificates,
|
||||
firstStart,
|
||||
quotations,
|
||||
historyItemsUrl,
|
||||
];
|
||||
}
|
||||
|
|
@ -5669,6 +6115,235 @@ typedef $$FirstStartTableProcessedTableManager =
|
|||
FirstStartData,
|
||||
PrefetchHooks Function()
|
||||
>;
|
||||
typedef $$QuotationsTableCreateCompanionBuilder =
|
||||
QuotationsCompanion Function({
|
||||
Value<int> id,
|
||||
required String pageUrl,
|
||||
Value<String?> pageTitle,
|
||||
Value<String?> author,
|
||||
Value<String?> siteTitle,
|
||||
required String quote,
|
||||
Value<DateTime> createdAt,
|
||||
});
|
||||
typedef $$QuotationsTableUpdateCompanionBuilder =
|
||||
QuotationsCompanion Function({
|
||||
Value<int> id,
|
||||
Value<String> pageUrl,
|
||||
Value<String?> pageTitle,
|
||||
Value<String?> author,
|
||||
Value<String?> siteTitle,
|
||||
Value<String> quote,
|
||||
Value<DateTime> createdAt,
|
||||
});
|
||||
|
||||
class $$QuotationsTableFilterComposer
|
||||
extends Composer<_$MewsDatabase, $QuotationsTable> {
|
||||
$$QuotationsTableFilterComposer({
|
||||
required super.$db,
|
||||
required super.$table,
|
||||
super.joinBuilder,
|
||||
super.$addJoinBuilderToRootComposer,
|
||||
super.$removeJoinBuilderFromRootComposer,
|
||||
});
|
||||
ColumnFilters<int> get id => $composableBuilder(
|
||||
column: $table.id,
|
||||
builder: (column) => ColumnFilters(column),
|
||||
);
|
||||
|
||||
ColumnFilters<String> get pageUrl => $composableBuilder(
|
||||
column: $table.pageUrl,
|
||||
builder: (column) => ColumnFilters(column),
|
||||
);
|
||||
|
||||
ColumnFilters<String> get pageTitle => $composableBuilder(
|
||||
column: $table.pageTitle,
|
||||
builder: (column) => ColumnFilters(column),
|
||||
);
|
||||
|
||||
ColumnFilters<String> get author => $composableBuilder(
|
||||
column: $table.author,
|
||||
builder: (column) => ColumnFilters(column),
|
||||
);
|
||||
|
||||
ColumnFilters<String> get siteTitle => $composableBuilder(
|
||||
column: $table.siteTitle,
|
||||
builder: (column) => ColumnFilters(column),
|
||||
);
|
||||
|
||||
ColumnFilters<String> get quote => $composableBuilder(
|
||||
column: $table.quote,
|
||||
builder: (column) => ColumnFilters(column),
|
||||
);
|
||||
|
||||
ColumnFilters<DateTime> get createdAt => $composableBuilder(
|
||||
column: $table.createdAt,
|
||||
builder: (column) => ColumnFilters(column),
|
||||
);
|
||||
}
|
||||
|
||||
class $$QuotationsTableOrderingComposer
|
||||
extends Composer<_$MewsDatabase, $QuotationsTable> {
|
||||
$$QuotationsTableOrderingComposer({
|
||||
required super.$db,
|
||||
required super.$table,
|
||||
super.joinBuilder,
|
||||
super.$addJoinBuilderToRootComposer,
|
||||
super.$removeJoinBuilderFromRootComposer,
|
||||
});
|
||||
ColumnOrderings<int> get id => $composableBuilder(
|
||||
column: $table.id,
|
||||
builder: (column) => ColumnOrderings(column),
|
||||
);
|
||||
|
||||
ColumnOrderings<String> get pageUrl => $composableBuilder(
|
||||
column: $table.pageUrl,
|
||||
builder: (column) => ColumnOrderings(column),
|
||||
);
|
||||
|
||||
ColumnOrderings<String> get pageTitle => $composableBuilder(
|
||||
column: $table.pageTitle,
|
||||
builder: (column) => ColumnOrderings(column),
|
||||
);
|
||||
|
||||
ColumnOrderings<String> get author => $composableBuilder(
|
||||
column: $table.author,
|
||||
builder: (column) => ColumnOrderings(column),
|
||||
);
|
||||
|
||||
ColumnOrderings<String> get siteTitle => $composableBuilder(
|
||||
column: $table.siteTitle,
|
||||
builder: (column) => ColumnOrderings(column),
|
||||
);
|
||||
|
||||
ColumnOrderings<String> get quote => $composableBuilder(
|
||||
column: $table.quote,
|
||||
builder: (column) => ColumnOrderings(column),
|
||||
);
|
||||
|
||||
ColumnOrderings<DateTime> get createdAt => $composableBuilder(
|
||||
column: $table.createdAt,
|
||||
builder: (column) => ColumnOrderings(column),
|
||||
);
|
||||
}
|
||||
|
||||
class $$QuotationsTableAnnotationComposer
|
||||
extends Composer<_$MewsDatabase, $QuotationsTable> {
|
||||
$$QuotationsTableAnnotationComposer({
|
||||
required super.$db,
|
||||
required super.$table,
|
||||
super.joinBuilder,
|
||||
super.$addJoinBuilderToRootComposer,
|
||||
super.$removeJoinBuilderFromRootComposer,
|
||||
});
|
||||
GeneratedColumn<int> get id =>
|
||||
$composableBuilder(column: $table.id, builder: (column) => column);
|
||||
|
||||
GeneratedColumn<String> get pageUrl =>
|
||||
$composableBuilder(column: $table.pageUrl, builder: (column) => column);
|
||||
|
||||
GeneratedColumn<String> get pageTitle =>
|
||||
$composableBuilder(column: $table.pageTitle, builder: (column) => column);
|
||||
|
||||
GeneratedColumn<String> get author =>
|
||||
$composableBuilder(column: $table.author, builder: (column) => column);
|
||||
|
||||
GeneratedColumn<String> get siteTitle =>
|
||||
$composableBuilder(column: $table.siteTitle, builder: (column) => column);
|
||||
|
||||
GeneratedColumn<String> get quote =>
|
||||
$composableBuilder(column: $table.quote, builder: (column) => column);
|
||||
|
||||
GeneratedColumn<DateTime> get createdAt =>
|
||||
$composableBuilder(column: $table.createdAt, builder: (column) => column);
|
||||
}
|
||||
|
||||
class $$QuotationsTableTableManager
|
||||
extends
|
||||
RootTableManager<
|
||||
_$MewsDatabase,
|
||||
$QuotationsTable,
|
||||
Quotation,
|
||||
$$QuotationsTableFilterComposer,
|
||||
$$QuotationsTableOrderingComposer,
|
||||
$$QuotationsTableAnnotationComposer,
|
||||
$$QuotationsTableCreateCompanionBuilder,
|
||||
$$QuotationsTableUpdateCompanionBuilder,
|
||||
(
|
||||
Quotation,
|
||||
BaseReferences<_$MewsDatabase, $QuotationsTable, Quotation>,
|
||||
),
|
||||
Quotation,
|
||||
PrefetchHooks Function()
|
||||
> {
|
||||
$$QuotationsTableTableManager(_$MewsDatabase db, $QuotationsTable table)
|
||||
: super(
|
||||
TableManagerState(
|
||||
db: db,
|
||||
table: table,
|
||||
createFilteringComposer: () =>
|
||||
$$QuotationsTableFilterComposer($db: db, $table: table),
|
||||
createOrderingComposer: () =>
|
||||
$$QuotationsTableOrderingComposer($db: db, $table: table),
|
||||
createComputedFieldComposer: () =>
|
||||
$$QuotationsTableAnnotationComposer($db: db, $table: table),
|
||||
updateCompanionCallback:
|
||||
({
|
||||
Value<int> id = const Value.absent(),
|
||||
Value<String> pageUrl = const Value.absent(),
|
||||
Value<String?> pageTitle = const Value.absent(),
|
||||
Value<String?> author = const Value.absent(),
|
||||
Value<String?> siteTitle = const Value.absent(),
|
||||
Value<String> quote = const Value.absent(),
|
||||
Value<DateTime> createdAt = const Value.absent(),
|
||||
}) => QuotationsCompanion(
|
||||
id: id,
|
||||
pageUrl: pageUrl,
|
||||
pageTitle: pageTitle,
|
||||
author: author,
|
||||
siteTitle: siteTitle,
|
||||
quote: quote,
|
||||
createdAt: createdAt,
|
||||
),
|
||||
createCompanionCallback:
|
||||
({
|
||||
Value<int> id = const Value.absent(),
|
||||
required String pageUrl,
|
||||
Value<String?> pageTitle = const Value.absent(),
|
||||
Value<String?> author = const Value.absent(),
|
||||
Value<String?> siteTitle = const Value.absent(),
|
||||
required String quote,
|
||||
Value<DateTime> createdAt = const Value.absent(),
|
||||
}) => QuotationsCompanion.insert(
|
||||
id: id,
|
||||
pageUrl: pageUrl,
|
||||
pageTitle: pageTitle,
|
||||
author: author,
|
||||
siteTitle: siteTitle,
|
||||
quote: quote,
|
||||
createdAt: createdAt,
|
||||
),
|
||||
withReferenceMapper: (p0) => p0
|
||||
.map((e) => (e.readTable(table), BaseReferences(db, table, e)))
|
||||
.toList(),
|
||||
prefetchHooksCallback: null,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
typedef $$QuotationsTableProcessedTableManager =
|
||||
ProcessedTableManager<
|
||||
_$MewsDatabase,
|
||||
$QuotationsTable,
|
||||
Quotation,
|
||||
$$QuotationsTableFilterComposer,
|
||||
$$QuotationsTableOrderingComposer,
|
||||
$$QuotationsTableAnnotationComposer,
|
||||
$$QuotationsTableCreateCompanionBuilder,
|
||||
$$QuotationsTableUpdateCompanionBuilder,
|
||||
(Quotation, BaseReferences<_$MewsDatabase, $QuotationsTable, Quotation>),
|
||||
Quotation,
|
||||
PrefetchHooks Function()
|
||||
>;
|
||||
|
||||
class $MewsDatabaseManager {
|
||||
final _$MewsDatabase _db;
|
||||
|
|
@ -5695,4 +6370,6 @@ class $MewsDatabaseManager {
|
|||
$$SiteCertificatesTableTableManager(_db, _db.siteCertificates);
|
||||
$$FirstStartTableTableManager get firstStart =>
|
||||
$$FirstStartTableTableManager(_db, _db.firstStart);
|
||||
$$QuotationsTableTableManager get quotations =>
|
||||
$$QuotationsTableTableManager(_db, _db.quotations);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue