initial
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright (c) 2024-2026 Fabian Freund.
|
||||
*
|
||||
* This file is part of WebLibre
|
||||
* (see https://weblibre.eu).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import 'package:drift/drift.dart';
|
||||
import 'package:weblibre/features/quotes/data/database/daos/quote.drift.dart';
|
||||
import 'package:weblibre/features/quotes/data/database/database.dart';
|
||||
import 'package:weblibre/features/quotes/data/database/definitions.drift.dart';
|
||||
|
||||
@DriftAccessor()
|
||||
class QuoteDao extends DatabaseAccessor<QuotesDatabase> with $QuoteDaoMixin {
|
||||
QuoteDao(super.db);
|
||||
|
||||
SingleOrNullSelectable<Quote> getRandomQuote() {
|
||||
final statement = select(db.quotes)
|
||||
..orderBy([(t) => OrderingTerm.random()])
|
||||
..limit(1);
|
||||
|
||||
return statement;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
// dart format width=80
|
||||
// ignore_for_file: type=lint
|
||||
import 'package:drift/drift.dart' as i0;
|
||||
import 'package:weblibre/features/quotes/data/database/database.dart' as i1;
|
||||
|
||||
mixin $QuoteDaoMixin on i0.DatabaseAccessor<i1.QuotesDatabase> {
|
||||
QuoteDaoManager get managers => QuoteDaoManager(this);
|
||||
}
|
||||
|
||||
class QuoteDaoManager {
|
||||
final $QuoteDaoMixin _db;
|
||||
QuoteDaoManager(this._db);
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright (c) 2024-2026 Fabian Freund.
|
||||
*
|
||||
* This file is part of WebLibre
|
||||
* (see https://weblibre.eu).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import 'package:drift/drift.dart';
|
||||
import 'package:drift_dev/api/migrations_native.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:weblibre/features/quotes/data/database/daos/quote.dart';
|
||||
import 'package:weblibre/features/quotes/data/database/database.drift.dart';
|
||||
|
||||
@DriftDatabase(include: {'definitions.drift'}, daos: [QuoteDao])
|
||||
class QuotesDatabase extends $QuotesDatabase {
|
||||
@override
|
||||
final int schemaVersion = 1;
|
||||
|
||||
@override
|
||||
MigrationStrategy get migration => MigrationStrategy(
|
||||
beforeOpen: (details) async {
|
||||
if (kDebugMode) {
|
||||
await validateDatabaseSchema();
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
QuotesDatabase(super.e);
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
// dart format width=80
|
||||
// ignore_for_file: type=lint
|
||||
import 'package:drift/drift.dart' as i0;
|
||||
import 'package:weblibre/features/quotes/data/database/definitions.drift.dart'
|
||||
as i1;
|
||||
import 'package:weblibre/features/quotes/data/database/daos/quote.dart' as i2;
|
||||
import 'package:weblibre/features/quotes/data/database/database.dart' as i3;
|
||||
import 'package:sqlite3/common.dart' as i4;
|
||||
|
||||
abstract class $QuotesDatabase extends i0.GeneratedDatabase {
|
||||
$QuotesDatabase(i0.QueryExecutor e) : super(e);
|
||||
$QuotesDatabaseManager get managers => $QuotesDatabaseManager(this);
|
||||
late final i1.Quotes quotes = i1.Quotes(this);
|
||||
late final i2.QuoteDao quoteDao = i2.QuoteDao(this as i3.QuotesDatabase);
|
||||
@override
|
||||
Iterable<i0.TableInfo<i0.Table, Object?>> get allTables =>
|
||||
allSchemaEntities.whereType<i0.TableInfo<i0.Table, Object?>>();
|
||||
@override
|
||||
List<i0.DatabaseSchemaEntity> get allSchemaEntities => [quotes];
|
||||
}
|
||||
|
||||
class $QuotesDatabaseManager {
|
||||
final $QuotesDatabase _db;
|
||||
$QuotesDatabaseManager(this._db);
|
||||
i1.$QuotesTableManager get quotes => i1.$QuotesTableManager(_db, _db.quotes);
|
||||
}
|
||||
|
||||
extension DefineFunctions on i4.CommonDatabase {
|
||||
void defineFunctions({
|
||||
required String Function(int, String?) lexoRankNext,
|
||||
required String Function(int, String?) lexoRankPrevious,
|
||||
required String Function(String?, String?) lexoRankReorderAfter,
|
||||
required String Function(String?, String?) lexoRankReorderBefore,
|
||||
}) {
|
||||
createFunction(
|
||||
functionName: 'lexo_rank_next',
|
||||
argumentCount: const i4.AllowedArgumentCount(2),
|
||||
function: (args) {
|
||||
final arg0 = args[0] as int;
|
||||
final arg1 = args[1] as String?;
|
||||
return lexoRankNext(arg0, arg1);
|
||||
},
|
||||
);
|
||||
createFunction(
|
||||
functionName: 'lexo_rank_previous',
|
||||
argumentCount: const i4.AllowedArgumentCount(2),
|
||||
function: (args) {
|
||||
final arg0 = args[0] as int;
|
||||
final arg1 = args[1] as String?;
|
||||
return lexoRankPrevious(arg0, arg1);
|
||||
},
|
||||
);
|
||||
createFunction(
|
||||
functionName: 'lexo_rank_reorder_after',
|
||||
argumentCount: const i4.AllowedArgumentCount(2),
|
||||
function: (args) {
|
||||
final arg0 = args[0] as String?;
|
||||
final arg1 = args[1] as String?;
|
||||
return lexoRankReorderAfter(arg0, arg1);
|
||||
},
|
||||
);
|
||||
createFunction(
|
||||
functionName: 'lexo_rank_reorder_before',
|
||||
argumentCount: const i4.AllowedArgumentCount(2),
|
||||
function: (args) {
|
||||
final arg0 = args[0] as String?;
|
||||
final arg1 = args[1] as String?;
|
||||
return lexoRankReorderBefore(arg0, arg1);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
CREATE TABLE quotes (
|
||||
author TEXT NOT NULL,
|
||||
quote TEXT NOT NULL,
|
||||
source TEXT,
|
||||
tags TEXT
|
||||
);
|
||||
@@ -0,0 +1,440 @@
|
||||
// dart format width=80
|
||||
// ignore_for_file: type=lint
|
||||
import 'package:drift/drift.dart' as i0;
|
||||
import 'package:weblibre/features/quotes/data/database/definitions.drift.dart'
|
||||
as i1;
|
||||
|
||||
typedef $QuotesCreateCompanionBuilder =
|
||||
i1.QuotesCompanion Function({
|
||||
required String author,
|
||||
required String quote,
|
||||
i0.Value<String?> source,
|
||||
i0.Value<String?> tags,
|
||||
i0.Value<int> rowid,
|
||||
});
|
||||
typedef $QuotesUpdateCompanionBuilder =
|
||||
i1.QuotesCompanion Function({
|
||||
i0.Value<String> author,
|
||||
i0.Value<String> quote,
|
||||
i0.Value<String?> source,
|
||||
i0.Value<String?> tags,
|
||||
i0.Value<int> rowid,
|
||||
});
|
||||
|
||||
class $QuotesFilterComposer
|
||||
extends i0.Composer<i0.GeneratedDatabase, i1.Quotes> {
|
||||
$QuotesFilterComposer({
|
||||
required super.$db,
|
||||
required super.$table,
|
||||
super.joinBuilder,
|
||||
super.$addJoinBuilderToRootComposer,
|
||||
super.$removeJoinBuilderFromRootComposer,
|
||||
});
|
||||
i0.ColumnFilters<String> get author => $composableBuilder(
|
||||
column: $table.author,
|
||||
builder: (column) => i0.ColumnFilters(column),
|
||||
);
|
||||
|
||||
i0.ColumnFilters<String> get quote => $composableBuilder(
|
||||
column: $table.quote,
|
||||
builder: (column) => i0.ColumnFilters(column),
|
||||
);
|
||||
|
||||
i0.ColumnFilters<String> get source => $composableBuilder(
|
||||
column: $table.source,
|
||||
builder: (column) => i0.ColumnFilters(column),
|
||||
);
|
||||
|
||||
i0.ColumnFilters<String> get tags => $composableBuilder(
|
||||
column: $table.tags,
|
||||
builder: (column) => i0.ColumnFilters(column),
|
||||
);
|
||||
}
|
||||
|
||||
class $QuotesOrderingComposer
|
||||
extends i0.Composer<i0.GeneratedDatabase, i1.Quotes> {
|
||||
$QuotesOrderingComposer({
|
||||
required super.$db,
|
||||
required super.$table,
|
||||
super.joinBuilder,
|
||||
super.$addJoinBuilderToRootComposer,
|
||||
super.$removeJoinBuilderFromRootComposer,
|
||||
});
|
||||
i0.ColumnOrderings<String> get author => $composableBuilder(
|
||||
column: $table.author,
|
||||
builder: (column) => i0.ColumnOrderings(column),
|
||||
);
|
||||
|
||||
i0.ColumnOrderings<String> get quote => $composableBuilder(
|
||||
column: $table.quote,
|
||||
builder: (column) => i0.ColumnOrderings(column),
|
||||
);
|
||||
|
||||
i0.ColumnOrderings<String> get source => $composableBuilder(
|
||||
column: $table.source,
|
||||
builder: (column) => i0.ColumnOrderings(column),
|
||||
);
|
||||
|
||||
i0.ColumnOrderings<String> get tags => $composableBuilder(
|
||||
column: $table.tags,
|
||||
builder: (column) => i0.ColumnOrderings(column),
|
||||
);
|
||||
}
|
||||
|
||||
class $QuotesAnnotationComposer
|
||||
extends i0.Composer<i0.GeneratedDatabase, i1.Quotes> {
|
||||
$QuotesAnnotationComposer({
|
||||
required super.$db,
|
||||
required super.$table,
|
||||
super.joinBuilder,
|
||||
super.$addJoinBuilderToRootComposer,
|
||||
super.$removeJoinBuilderFromRootComposer,
|
||||
});
|
||||
i0.GeneratedColumn<String> get author =>
|
||||
$composableBuilder(column: $table.author, builder: (column) => column);
|
||||
|
||||
i0.GeneratedColumn<String> get quote =>
|
||||
$composableBuilder(column: $table.quote, builder: (column) => column);
|
||||
|
||||
i0.GeneratedColumn<String> get source =>
|
||||
$composableBuilder(column: $table.source, builder: (column) => column);
|
||||
|
||||
i0.GeneratedColumn<String> get tags =>
|
||||
$composableBuilder(column: $table.tags, builder: (column) => column);
|
||||
}
|
||||
|
||||
class $QuotesTableManager
|
||||
extends
|
||||
i0.RootTableManager<
|
||||
i0.GeneratedDatabase,
|
||||
i1.Quotes,
|
||||
i1.Quote,
|
||||
i1.$QuotesFilterComposer,
|
||||
i1.$QuotesOrderingComposer,
|
||||
i1.$QuotesAnnotationComposer,
|
||||
$QuotesCreateCompanionBuilder,
|
||||
$QuotesUpdateCompanionBuilder,
|
||||
(
|
||||
i1.Quote,
|
||||
i0.BaseReferences<i0.GeneratedDatabase, i1.Quotes, i1.Quote>,
|
||||
),
|
||||
i1.Quote,
|
||||
i0.PrefetchHooks Function()
|
||||
> {
|
||||
$QuotesTableManager(i0.GeneratedDatabase db, i1.Quotes table)
|
||||
: super(
|
||||
i0.TableManagerState(
|
||||
db: db,
|
||||
table: table,
|
||||
createFilteringComposer: () =>
|
||||
i1.$QuotesFilterComposer($db: db, $table: table),
|
||||
createOrderingComposer: () =>
|
||||
i1.$QuotesOrderingComposer($db: db, $table: table),
|
||||
createComputedFieldComposer: () =>
|
||||
i1.$QuotesAnnotationComposer($db: db, $table: table),
|
||||
updateCompanionCallback:
|
||||
({
|
||||
i0.Value<String> author = const i0.Value.absent(),
|
||||
i0.Value<String> quote = const i0.Value.absent(),
|
||||
i0.Value<String?> source = const i0.Value.absent(),
|
||||
i0.Value<String?> tags = const i0.Value.absent(),
|
||||
i0.Value<int> rowid = const i0.Value.absent(),
|
||||
}) => i1.QuotesCompanion(
|
||||
author: author,
|
||||
quote: quote,
|
||||
source: source,
|
||||
tags: tags,
|
||||
rowid: rowid,
|
||||
),
|
||||
createCompanionCallback:
|
||||
({
|
||||
required String author,
|
||||
required String quote,
|
||||
i0.Value<String?> source = const i0.Value.absent(),
|
||||
i0.Value<String?> tags = const i0.Value.absent(),
|
||||
i0.Value<int> rowid = const i0.Value.absent(),
|
||||
}) => i1.QuotesCompanion.insert(
|
||||
author: author,
|
||||
quote: quote,
|
||||
source: source,
|
||||
tags: tags,
|
||||
rowid: rowid,
|
||||
),
|
||||
withReferenceMapper: (p0) => p0
|
||||
.map((e) => (e.readTable(table), i0.BaseReferences(db, table, e)))
|
||||
.toList(),
|
||||
prefetchHooksCallback: null,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
typedef $QuotesProcessedTableManager =
|
||||
i0.ProcessedTableManager<
|
||||
i0.GeneratedDatabase,
|
||||
i1.Quotes,
|
||||
i1.Quote,
|
||||
i1.$QuotesFilterComposer,
|
||||
i1.$QuotesOrderingComposer,
|
||||
i1.$QuotesAnnotationComposer,
|
||||
$QuotesCreateCompanionBuilder,
|
||||
$QuotesUpdateCompanionBuilder,
|
||||
(i1.Quote, i0.BaseReferences<i0.GeneratedDatabase, i1.Quotes, i1.Quote>),
|
||||
i1.Quote,
|
||||
i0.PrefetchHooks Function()
|
||||
>;
|
||||
|
||||
class Quotes extends i0.Table with i0.TableInfo<Quotes, i1.Quote> {
|
||||
@override
|
||||
final i0.GeneratedDatabase attachedDatabase;
|
||||
final String? _alias;
|
||||
Quotes(this.attachedDatabase, [this._alias]);
|
||||
late final i0.GeneratedColumn<String> author = i0.GeneratedColumn<String>(
|
||||
'author',
|
||||
aliasedName,
|
||||
false,
|
||||
type: i0.DriftSqlType.string,
|
||||
requiredDuringInsert: true,
|
||||
$customConstraints: 'NOT NULL',
|
||||
);
|
||||
late final i0.GeneratedColumn<String> quote = i0.GeneratedColumn<String>(
|
||||
'quote',
|
||||
aliasedName,
|
||||
false,
|
||||
type: i0.DriftSqlType.string,
|
||||
requiredDuringInsert: true,
|
||||
$customConstraints: 'NOT NULL',
|
||||
);
|
||||
late final i0.GeneratedColumn<String> source = i0.GeneratedColumn<String>(
|
||||
'source',
|
||||
aliasedName,
|
||||
true,
|
||||
type: i0.DriftSqlType.string,
|
||||
requiredDuringInsert: false,
|
||||
$customConstraints: '',
|
||||
);
|
||||
late final i0.GeneratedColumn<String> tags = i0.GeneratedColumn<String>(
|
||||
'tags',
|
||||
aliasedName,
|
||||
true,
|
||||
type: i0.DriftSqlType.string,
|
||||
requiredDuringInsert: false,
|
||||
$customConstraints: '',
|
||||
);
|
||||
@override
|
||||
List<i0.GeneratedColumn> get $columns => [author, quote, source, tags];
|
||||
@override
|
||||
String get aliasedName => _alias ?? actualTableName;
|
||||
@override
|
||||
String get actualTableName => $name;
|
||||
static const String $name = 'quotes';
|
||||
@override
|
||||
Set<i0.GeneratedColumn> get $primaryKey => const {};
|
||||
@override
|
||||
i1.Quote map(Map<String, dynamic> data, {String? tablePrefix}) {
|
||||
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
||||
return i1.Quote(
|
||||
author: attachedDatabase.typeMapping.read(
|
||||
i0.DriftSqlType.string,
|
||||
data['${effectivePrefix}author'],
|
||||
)!,
|
||||
quote: attachedDatabase.typeMapping.read(
|
||||
i0.DriftSqlType.string,
|
||||
data['${effectivePrefix}quote'],
|
||||
)!,
|
||||
source: attachedDatabase.typeMapping.read(
|
||||
i0.DriftSqlType.string,
|
||||
data['${effectivePrefix}source'],
|
||||
),
|
||||
tags: attachedDatabase.typeMapping.read(
|
||||
i0.DriftSqlType.string,
|
||||
data['${effectivePrefix}tags'],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Quotes createAlias(String alias) {
|
||||
return Quotes(attachedDatabase, alias);
|
||||
}
|
||||
|
||||
@override
|
||||
bool get dontWriteConstraints => true;
|
||||
}
|
||||
|
||||
class Quote extends i0.DataClass implements i0.Insertable<i1.Quote> {
|
||||
final String author;
|
||||
final String quote;
|
||||
final String? source;
|
||||
final String? tags;
|
||||
const Quote({
|
||||
required this.author,
|
||||
required this.quote,
|
||||
this.source,
|
||||
this.tags,
|
||||
});
|
||||
@override
|
||||
Map<String, i0.Expression> toColumns(bool nullToAbsent) {
|
||||
final map = <String, i0.Expression>{};
|
||||
map['author'] = i0.Variable<String>(author);
|
||||
map['quote'] = i0.Variable<String>(quote);
|
||||
if (!nullToAbsent || source != null) {
|
||||
map['source'] = i0.Variable<String>(source);
|
||||
}
|
||||
if (!nullToAbsent || tags != null) {
|
||||
map['tags'] = i0.Variable<String>(tags);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
factory Quote.fromJson(
|
||||
Map<String, dynamic> json, {
|
||||
i0.ValueSerializer? serializer,
|
||||
}) {
|
||||
serializer ??= i0.driftRuntimeOptions.defaultSerializer;
|
||||
return Quote(
|
||||
author: serializer.fromJson<String>(json['author']),
|
||||
quote: serializer.fromJson<String>(json['quote']),
|
||||
source: serializer.fromJson<String?>(json['source']),
|
||||
tags: serializer.fromJson<String?>(json['tags']),
|
||||
);
|
||||
}
|
||||
@override
|
||||
Map<String, dynamic> toJson({i0.ValueSerializer? serializer}) {
|
||||
serializer ??= i0.driftRuntimeOptions.defaultSerializer;
|
||||
return <String, dynamic>{
|
||||
'author': serializer.toJson<String>(author),
|
||||
'quote': serializer.toJson<String>(quote),
|
||||
'source': serializer.toJson<String?>(source),
|
||||
'tags': serializer.toJson<String?>(tags),
|
||||
};
|
||||
}
|
||||
|
||||
i1.Quote copyWith({
|
||||
String? author,
|
||||
String? quote,
|
||||
i0.Value<String?> source = const i0.Value.absent(),
|
||||
i0.Value<String?> tags = const i0.Value.absent(),
|
||||
}) => i1.Quote(
|
||||
author: author ?? this.author,
|
||||
quote: quote ?? this.quote,
|
||||
source: source.present ? source.value : this.source,
|
||||
tags: tags.present ? tags.value : this.tags,
|
||||
);
|
||||
Quote copyWithCompanion(i1.QuotesCompanion data) {
|
||||
return Quote(
|
||||
author: data.author.present ? data.author.value : this.author,
|
||||
quote: data.quote.present ? data.quote.value : this.quote,
|
||||
source: data.source.present ? data.source.value : this.source,
|
||||
tags: data.tags.present ? data.tags.value : this.tags,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return (StringBuffer('Quote(')
|
||||
..write('author: $author, ')
|
||||
..write('quote: $quote, ')
|
||||
..write('source: $source, ')
|
||||
..write('tags: $tags')
|
||||
..write(')'))
|
||||
.toString();
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(author, quote, source, tags);
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
(other is i1.Quote &&
|
||||
other.author == this.author &&
|
||||
other.quote == this.quote &&
|
||||
other.source == this.source &&
|
||||
other.tags == this.tags);
|
||||
}
|
||||
|
||||
class QuotesCompanion extends i0.UpdateCompanion<i1.Quote> {
|
||||
final i0.Value<String> author;
|
||||
final i0.Value<String> quote;
|
||||
final i0.Value<String?> source;
|
||||
final i0.Value<String?> tags;
|
||||
final i0.Value<int> rowid;
|
||||
const QuotesCompanion({
|
||||
this.author = const i0.Value.absent(),
|
||||
this.quote = const i0.Value.absent(),
|
||||
this.source = const i0.Value.absent(),
|
||||
this.tags = const i0.Value.absent(),
|
||||
this.rowid = const i0.Value.absent(),
|
||||
});
|
||||
QuotesCompanion.insert({
|
||||
required String author,
|
||||
required String quote,
|
||||
this.source = const i0.Value.absent(),
|
||||
this.tags = const i0.Value.absent(),
|
||||
this.rowid = const i0.Value.absent(),
|
||||
}) : author = i0.Value(author),
|
||||
quote = i0.Value(quote);
|
||||
static i0.Insertable<i1.Quote> custom({
|
||||
i0.Expression<String>? author,
|
||||
i0.Expression<String>? quote,
|
||||
i0.Expression<String>? source,
|
||||
i0.Expression<String>? tags,
|
||||
i0.Expression<int>? rowid,
|
||||
}) {
|
||||
return i0.RawValuesInsertable({
|
||||
if (author != null) 'author': author,
|
||||
if (quote != null) 'quote': quote,
|
||||
if (source != null) 'source': source,
|
||||
if (tags != null) 'tags': tags,
|
||||
if (rowid != null) 'rowid': rowid,
|
||||
});
|
||||
}
|
||||
|
||||
i1.QuotesCompanion copyWith({
|
||||
i0.Value<String>? author,
|
||||
i0.Value<String>? quote,
|
||||
i0.Value<String?>? source,
|
||||
i0.Value<String?>? tags,
|
||||
i0.Value<int>? rowid,
|
||||
}) {
|
||||
return i1.QuotesCompanion(
|
||||
author: author ?? this.author,
|
||||
quote: quote ?? this.quote,
|
||||
source: source ?? this.source,
|
||||
tags: tags ?? this.tags,
|
||||
rowid: rowid ?? this.rowid,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Map<String, i0.Expression> toColumns(bool nullToAbsent) {
|
||||
final map = <String, i0.Expression>{};
|
||||
if (author.present) {
|
||||
map['author'] = i0.Variable<String>(author.value);
|
||||
}
|
||||
if (quote.present) {
|
||||
map['quote'] = i0.Variable<String>(quote.value);
|
||||
}
|
||||
if (source.present) {
|
||||
map['source'] = i0.Variable<String>(source.value);
|
||||
}
|
||||
if (tags.present) {
|
||||
map['tags'] = i0.Variable<String>(tags.value);
|
||||
}
|
||||
if (rowid.present) {
|
||||
map['rowid'] = i0.Variable<int>(rowid.value);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return (StringBuffer('QuotesCompanion(')
|
||||
..write('author: $author, ')
|
||||
..write('quote: $quote, ')
|
||||
..write('source: $source, ')
|
||||
..write('tags: $tags, ')
|
||||
..write('rowid: $rowid')
|
||||
..write(')'))
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user