mirror of https://github.com/AMT-Cheif/drift.git
804 lines
25 KiB
Dart
804 lines
25 KiB
Dart
// GENERATED CODE, DO NOT EDIT BY HAND.
|
|
// ignore_for_file: type=lint
|
|
//@dart=2.12
|
|
import 'package:drift/drift.dart';
|
|
|
|
class Users extends Table with TableInfo<Users, UsersData> {
|
|
@override
|
|
final GeneratedDatabase attachedDatabase;
|
|
final String? _alias;
|
|
Users(this.attachedDatabase, [this._alias]);
|
|
late final GeneratedColumn<int> id = GeneratedColumn<int>(
|
|
'id', aliasedName, false,
|
|
hasAutoIncrement: true,
|
|
type: DriftSqlType.int,
|
|
requiredDuringInsert: false,
|
|
defaultConstraints:
|
|
GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT'));
|
|
late final GeneratedColumn<String> name = GeneratedColumn<String>(
|
|
'name', aliasedName, false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant('name'));
|
|
late final GeneratedColumn<DateTime> birthday = GeneratedColumn<DateTime>(
|
|
'birthday', aliasedName, true,
|
|
type: DriftSqlType.dateTime, requiredDuringInsert: false);
|
|
late final GeneratedColumn<int> nextUser = GeneratedColumn<int>(
|
|
'next_user', aliasedName, true,
|
|
type: DriftSqlType.int,
|
|
requiredDuringInsert: false,
|
|
defaultConstraints:
|
|
GeneratedColumn.constraintIsAlways('REFERENCES "users" ("id")'));
|
|
@override
|
|
List<GeneratedColumn> get $columns => [id, name, birthday, nextUser];
|
|
@override
|
|
String get aliasedName => _alias ?? actualTableName;
|
|
@override
|
|
String get actualTableName => $name;
|
|
static const String $name = 'users';
|
|
@override
|
|
Set<GeneratedColumn> get $primaryKey => {id};
|
|
@override
|
|
List<Set<GeneratedColumn>> get uniqueKeys => [
|
|
{name, birthday},
|
|
];
|
|
@override
|
|
UsersData map(Map<String, dynamic> data, {String? tablePrefix}) {
|
|
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
|
return UsersData(
|
|
id: attachedDatabase.typeMapping
|
|
.read(DriftSqlType.int, data['${effectivePrefix}id'])!,
|
|
name: attachedDatabase.typeMapping
|
|
.read(DriftSqlType.string, data['${effectivePrefix}name'])!,
|
|
birthday: attachedDatabase.typeMapping
|
|
.read(DriftSqlType.dateTime, data['${effectivePrefix}birthday']),
|
|
nextUser: attachedDatabase.typeMapping
|
|
.read(DriftSqlType.int, data['${effectivePrefix}next_user']),
|
|
);
|
|
}
|
|
|
|
@override
|
|
Users createAlias(String alias) {
|
|
return Users(attachedDatabase, alias);
|
|
}
|
|
}
|
|
|
|
class UsersData extends DataClass implements Insertable<UsersData> {
|
|
final int id;
|
|
final String name;
|
|
final DateTime? birthday;
|
|
final int? nextUser;
|
|
const UsersData(
|
|
{required this.id, required this.name, this.birthday, this.nextUser});
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
map['id'] = Variable<int>(id);
|
|
map['name'] = Variable<String>(name);
|
|
if (!nullToAbsent || birthday != null) {
|
|
map['birthday'] = Variable<DateTime>(birthday);
|
|
}
|
|
if (!nullToAbsent || nextUser != null) {
|
|
map['next_user'] = Variable<int>(nextUser);
|
|
}
|
|
return map;
|
|
}
|
|
|
|
UsersCompanion toCompanion(bool nullToAbsent) {
|
|
return UsersCompanion(
|
|
id: Value(id),
|
|
name: Value(name),
|
|
birthday: birthday == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(birthday),
|
|
nextUser: nextUser == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(nextUser),
|
|
);
|
|
}
|
|
|
|
factory UsersData.fromJson(Map<String, dynamic> json,
|
|
{ValueSerializer? serializer}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return UsersData(
|
|
id: serializer.fromJson<int>(json['id']),
|
|
name: serializer.fromJson<String>(json['name']),
|
|
birthday: serializer.fromJson<DateTime?>(json['birthday']),
|
|
nextUser: serializer.fromJson<int?>(json['nextUser']),
|
|
);
|
|
}
|
|
@override
|
|
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return <String, dynamic>{
|
|
'id': serializer.toJson<int>(id),
|
|
'name': serializer.toJson<String>(name),
|
|
'birthday': serializer.toJson<DateTime?>(birthday),
|
|
'nextUser': serializer.toJson<int?>(nextUser),
|
|
};
|
|
}
|
|
|
|
UsersData copyWith(
|
|
{int? id,
|
|
String? name,
|
|
Value<DateTime?> birthday = const Value.absent(),
|
|
Value<int?> nextUser = const Value.absent()}) =>
|
|
UsersData(
|
|
id: id ?? this.id,
|
|
name: name ?? this.name,
|
|
birthday: birthday.present ? birthday.value : this.birthday,
|
|
nextUser: nextUser.present ? nextUser.value : this.nextUser,
|
|
);
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('UsersData(')
|
|
..write('id: $id, ')
|
|
..write('name: $name, ')
|
|
..write('birthday: $birthday, ')
|
|
..write('nextUser: $nextUser')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
|
|
@override
|
|
int get hashCode => Object.hash(id, name, birthday, nextUser);
|
|
@override
|
|
bool operator ==(Object other) =>
|
|
identical(this, other) ||
|
|
(other is UsersData &&
|
|
other.id == this.id &&
|
|
other.name == this.name &&
|
|
other.birthday == this.birthday &&
|
|
other.nextUser == this.nextUser);
|
|
}
|
|
|
|
class UsersCompanion extends UpdateCompanion<UsersData> {
|
|
final Value<int> id;
|
|
final Value<String> name;
|
|
final Value<DateTime?> birthday;
|
|
final Value<int?> nextUser;
|
|
const UsersCompanion({
|
|
this.id = const Value.absent(),
|
|
this.name = const Value.absent(),
|
|
this.birthday = const Value.absent(),
|
|
this.nextUser = const Value.absent(),
|
|
});
|
|
UsersCompanion.insert({
|
|
this.id = const Value.absent(),
|
|
this.name = const Value.absent(),
|
|
this.birthday = const Value.absent(),
|
|
this.nextUser = const Value.absent(),
|
|
});
|
|
static Insertable<UsersData> custom({
|
|
Expression<int>? id,
|
|
Expression<String>? name,
|
|
Expression<DateTime>? birthday,
|
|
Expression<int>? nextUser,
|
|
}) {
|
|
return RawValuesInsertable({
|
|
if (id != null) 'id': id,
|
|
if (name != null) 'name': name,
|
|
if (birthday != null) 'birthday': birthday,
|
|
if (nextUser != null) 'next_user': nextUser,
|
|
});
|
|
}
|
|
|
|
UsersCompanion copyWith(
|
|
{Value<int>? id,
|
|
Value<String>? name,
|
|
Value<DateTime?>? birthday,
|
|
Value<int?>? nextUser}) {
|
|
return UsersCompanion(
|
|
id: id ?? this.id,
|
|
name: name ?? this.name,
|
|
birthday: birthday ?? this.birthday,
|
|
nextUser: nextUser ?? this.nextUser,
|
|
);
|
|
}
|
|
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
if (id.present) {
|
|
map['id'] = Variable<int>(id.value);
|
|
}
|
|
if (name.present) {
|
|
map['name'] = Variable<String>(name.value);
|
|
}
|
|
if (birthday.present) {
|
|
map['birthday'] = Variable<DateTime>(birthday.value);
|
|
}
|
|
if (nextUser.present) {
|
|
map['next_user'] = Variable<int>(nextUser.value);
|
|
}
|
|
return map;
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('UsersCompanion(')
|
|
..write('id: $id, ')
|
|
..write('name: $name, ')
|
|
..write('birthday: $birthday, ')
|
|
..write('nextUser: $nextUser')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
}
|
|
|
|
class Groups extends Table with TableInfo<Groups, GroupsData> {
|
|
@override
|
|
final GeneratedDatabase attachedDatabase;
|
|
final String? _alias;
|
|
Groups(this.attachedDatabase, [this._alias]);
|
|
late final GeneratedColumn<int> id = GeneratedColumn<int>(
|
|
'id', aliasedName, false,
|
|
type: DriftSqlType.int,
|
|
requiredDuringInsert: false,
|
|
$customConstraints: 'NOT NULL');
|
|
late final GeneratedColumn<String> title = GeneratedColumn<String>(
|
|
'title', aliasedName, false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
$customConstraints: 'NOT NULL');
|
|
late final GeneratedColumn<bool> deleted = GeneratedColumn<bool>(
|
|
'deleted', aliasedName, true,
|
|
type: DriftSqlType.bool,
|
|
requiredDuringInsert: false,
|
|
$customConstraints: 'DEFAULT FALSE',
|
|
defaultValue: const CustomExpression<bool>('FALSE'));
|
|
late final GeneratedColumn<int> owner = GeneratedColumn<int>(
|
|
'owner', aliasedName, false,
|
|
type: DriftSqlType.int,
|
|
requiredDuringInsert: true,
|
|
$customConstraints: 'NOT NULL REFERENCES users (id)');
|
|
@override
|
|
List<GeneratedColumn> get $columns => [id, title, deleted, owner];
|
|
@override
|
|
String get aliasedName => _alias ?? actualTableName;
|
|
@override
|
|
String get actualTableName => $name;
|
|
static const String $name = 'groups';
|
|
@override
|
|
Set<GeneratedColumn> get $primaryKey => {id};
|
|
@override
|
|
GroupsData map(Map<String, dynamic> data, {String? tablePrefix}) {
|
|
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
|
return GroupsData(
|
|
id: attachedDatabase.typeMapping
|
|
.read(DriftSqlType.int, data['${effectivePrefix}id'])!,
|
|
title: attachedDatabase.typeMapping
|
|
.read(DriftSqlType.string, data['${effectivePrefix}title'])!,
|
|
deleted: attachedDatabase.typeMapping
|
|
.read(DriftSqlType.bool, data['${effectivePrefix}deleted']),
|
|
owner: attachedDatabase.typeMapping
|
|
.read(DriftSqlType.int, data['${effectivePrefix}owner'])!,
|
|
);
|
|
}
|
|
|
|
@override
|
|
Groups createAlias(String alias) {
|
|
return Groups(attachedDatabase, alias);
|
|
}
|
|
|
|
@override
|
|
List<String> get customConstraints => const ['PRIMARY KEY (id)'];
|
|
@override
|
|
bool get dontWriteConstraints => true;
|
|
}
|
|
|
|
class GroupsData extends DataClass implements Insertable<GroupsData> {
|
|
final int id;
|
|
final String title;
|
|
final bool? deleted;
|
|
final int owner;
|
|
const GroupsData(
|
|
{required this.id,
|
|
required this.title,
|
|
this.deleted,
|
|
required this.owner});
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
map['id'] = Variable<int>(id);
|
|
map['title'] = Variable<String>(title);
|
|
if (!nullToAbsent || deleted != null) {
|
|
map['deleted'] = Variable<bool>(deleted);
|
|
}
|
|
map['owner'] = Variable<int>(owner);
|
|
return map;
|
|
}
|
|
|
|
GroupsCompanion toCompanion(bool nullToAbsent) {
|
|
return GroupsCompanion(
|
|
id: Value(id),
|
|
title: Value(title),
|
|
deleted: deleted == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(deleted),
|
|
owner: Value(owner),
|
|
);
|
|
}
|
|
|
|
factory GroupsData.fromJson(Map<String, dynamic> json,
|
|
{ValueSerializer? serializer}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return GroupsData(
|
|
id: serializer.fromJson<int>(json['id']),
|
|
title: serializer.fromJson<String>(json['title']),
|
|
deleted: serializer.fromJson<bool?>(json['deleted']),
|
|
owner: serializer.fromJson<int>(json['owner']),
|
|
);
|
|
}
|
|
@override
|
|
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return <String, dynamic>{
|
|
'id': serializer.toJson<int>(id),
|
|
'title': serializer.toJson<String>(title),
|
|
'deleted': serializer.toJson<bool?>(deleted),
|
|
'owner': serializer.toJson<int>(owner),
|
|
};
|
|
}
|
|
|
|
GroupsData copyWith(
|
|
{int? id,
|
|
String? title,
|
|
Value<bool?> deleted = const Value.absent(),
|
|
int? owner}) =>
|
|
GroupsData(
|
|
id: id ?? this.id,
|
|
title: title ?? this.title,
|
|
deleted: deleted.present ? deleted.value : this.deleted,
|
|
owner: owner ?? this.owner,
|
|
);
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('GroupsData(')
|
|
..write('id: $id, ')
|
|
..write('title: $title, ')
|
|
..write('deleted: $deleted, ')
|
|
..write('owner: $owner')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
|
|
@override
|
|
int get hashCode => Object.hash(id, title, deleted, owner);
|
|
@override
|
|
bool operator ==(Object other) =>
|
|
identical(this, other) ||
|
|
(other is GroupsData &&
|
|
other.id == this.id &&
|
|
other.title == this.title &&
|
|
other.deleted == this.deleted &&
|
|
other.owner == this.owner);
|
|
}
|
|
|
|
class GroupsCompanion extends UpdateCompanion<GroupsData> {
|
|
final Value<int> id;
|
|
final Value<String> title;
|
|
final Value<bool?> deleted;
|
|
final Value<int> owner;
|
|
const GroupsCompanion({
|
|
this.id = const Value.absent(),
|
|
this.title = const Value.absent(),
|
|
this.deleted = const Value.absent(),
|
|
this.owner = const Value.absent(),
|
|
});
|
|
GroupsCompanion.insert({
|
|
this.id = const Value.absent(),
|
|
required String title,
|
|
this.deleted = const Value.absent(),
|
|
required int owner,
|
|
}) : title = Value(title),
|
|
owner = Value(owner);
|
|
static Insertable<GroupsData> custom({
|
|
Expression<int>? id,
|
|
Expression<String>? title,
|
|
Expression<bool>? deleted,
|
|
Expression<int>? owner,
|
|
}) {
|
|
return RawValuesInsertable({
|
|
if (id != null) 'id': id,
|
|
if (title != null) 'title': title,
|
|
if (deleted != null) 'deleted': deleted,
|
|
if (owner != null) 'owner': owner,
|
|
});
|
|
}
|
|
|
|
GroupsCompanion copyWith(
|
|
{Value<int>? id,
|
|
Value<String>? title,
|
|
Value<bool?>? deleted,
|
|
Value<int>? owner}) {
|
|
return GroupsCompanion(
|
|
id: id ?? this.id,
|
|
title: title ?? this.title,
|
|
deleted: deleted ?? this.deleted,
|
|
owner: owner ?? this.owner,
|
|
);
|
|
}
|
|
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
if (id.present) {
|
|
map['id'] = Variable<int>(id.value);
|
|
}
|
|
if (title.present) {
|
|
map['title'] = Variable<String>(title.value);
|
|
}
|
|
if (deleted.present) {
|
|
map['deleted'] = Variable<bool>(deleted.value);
|
|
}
|
|
if (owner.present) {
|
|
map['owner'] = Variable<int>(owner.value);
|
|
}
|
|
return map;
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('GroupsCompanion(')
|
|
..write('id: $id, ')
|
|
..write('title: $title, ')
|
|
..write('deleted: $deleted, ')
|
|
..write('owner: $owner')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
}
|
|
|
|
class GroupCountData extends DataClass {
|
|
final int id;
|
|
final String name;
|
|
final DateTime? birthday;
|
|
final int? nextUser;
|
|
final int groupCount;
|
|
const GroupCountData(
|
|
{required this.id,
|
|
required this.name,
|
|
this.birthday,
|
|
this.nextUser,
|
|
required this.groupCount});
|
|
factory GroupCountData.fromJson(Map<String, dynamic> json,
|
|
{ValueSerializer? serializer}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return GroupCountData(
|
|
id: serializer.fromJson<int>(json['id']),
|
|
name: serializer.fromJson<String>(json['name']),
|
|
birthday: serializer.fromJson<DateTime?>(json['birthday']),
|
|
nextUser: serializer.fromJson<int?>(json['nextUser']),
|
|
groupCount: serializer.fromJson<int>(json['groupCount']),
|
|
);
|
|
}
|
|
@override
|
|
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return <String, dynamic>{
|
|
'id': serializer.toJson<int>(id),
|
|
'name': serializer.toJson<String>(name),
|
|
'birthday': serializer.toJson<DateTime?>(birthday),
|
|
'nextUser': serializer.toJson<int?>(nextUser),
|
|
'groupCount': serializer.toJson<int>(groupCount),
|
|
};
|
|
}
|
|
|
|
GroupCountData copyWith(
|
|
{int? id,
|
|
String? name,
|
|
Value<DateTime?> birthday = const Value.absent(),
|
|
Value<int?> nextUser = const Value.absent(),
|
|
int? groupCount}) =>
|
|
GroupCountData(
|
|
id: id ?? this.id,
|
|
name: name ?? this.name,
|
|
birthday: birthday.present ? birthday.value : this.birthday,
|
|
nextUser: nextUser.present ? nextUser.value : this.nextUser,
|
|
groupCount: groupCount ?? this.groupCount,
|
|
);
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('GroupCountData(')
|
|
..write('id: $id, ')
|
|
..write('name: $name, ')
|
|
..write('birthday: $birthday, ')
|
|
..write('nextUser: $nextUser, ')
|
|
..write('groupCount: $groupCount')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
|
|
@override
|
|
int get hashCode => Object.hash(id, name, birthday, nextUser, groupCount);
|
|
@override
|
|
bool operator ==(Object other) =>
|
|
identical(this, other) ||
|
|
(other is GroupCountData &&
|
|
other.id == this.id &&
|
|
other.name == this.name &&
|
|
other.birthday == this.birthday &&
|
|
other.nextUser == this.nextUser &&
|
|
other.groupCount == this.groupCount);
|
|
}
|
|
|
|
class GroupCount extends ViewInfo<GroupCount, GroupCountData>
|
|
implements HasResultSet {
|
|
final String? _alias;
|
|
@override
|
|
final DatabaseAtV8 attachedDatabase;
|
|
GroupCount(this.attachedDatabase, [this._alias]);
|
|
@override
|
|
List<GeneratedColumn> get $columns =>
|
|
[id, name, birthday, nextUser, groupCount];
|
|
@override
|
|
String get aliasedName => _alias ?? entityName;
|
|
@override
|
|
String get entityName => 'group_count';
|
|
@override
|
|
Map<SqlDialect, String> get createViewStatements => {
|
|
SqlDialect.sqlite:
|
|
'CREATE VIEW group_count AS SELECT users.*, (SELECT COUNT(*) FROM "groups" WHERE owner = users.id) AS group_count FROM users'
|
|
};
|
|
@override
|
|
GroupCount get asDslTable => this;
|
|
@override
|
|
GroupCountData map(Map<String, dynamic> data, {String? tablePrefix}) {
|
|
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
|
return GroupCountData(
|
|
id: attachedDatabase.typeMapping
|
|
.read(DriftSqlType.int, data['${effectivePrefix}id'])!,
|
|
name: attachedDatabase.typeMapping
|
|
.read(DriftSqlType.string, data['${effectivePrefix}name'])!,
|
|
birthday: attachedDatabase.typeMapping
|
|
.read(DriftSqlType.dateTime, data['${effectivePrefix}birthday']),
|
|
nextUser: attachedDatabase.typeMapping
|
|
.read(DriftSqlType.int, data['${effectivePrefix}next_user']),
|
|
groupCount: attachedDatabase.typeMapping
|
|
.read(DriftSqlType.int, data['${effectivePrefix}group_count'])!,
|
|
);
|
|
}
|
|
|
|
late final GeneratedColumn<int> id =
|
|
GeneratedColumn<int>('id', aliasedName, false, type: DriftSqlType.int);
|
|
late final GeneratedColumn<String> name = GeneratedColumn<String>(
|
|
'name', aliasedName, false,
|
|
type: DriftSqlType.string);
|
|
late final GeneratedColumn<DateTime> birthday = GeneratedColumn<DateTime>(
|
|
'birthday', aliasedName, true,
|
|
type: DriftSqlType.dateTime);
|
|
late final GeneratedColumn<int> nextUser = GeneratedColumn<int>(
|
|
'next_user', aliasedName, true,
|
|
type: DriftSqlType.int);
|
|
late final GeneratedColumn<int> groupCount = GeneratedColumn<int>(
|
|
'group_count', aliasedName, false,
|
|
type: DriftSqlType.int);
|
|
@override
|
|
GroupCount createAlias(String alias) {
|
|
return GroupCount(attachedDatabase, alias);
|
|
}
|
|
|
|
@override
|
|
Query? get query => null;
|
|
@override
|
|
Set<String> get readTables => const {};
|
|
}
|
|
|
|
class Notes extends Table
|
|
with TableInfo<Notes, NotesData>, VirtualTableInfo<Notes, NotesData> {
|
|
@override
|
|
final GeneratedDatabase attachedDatabase;
|
|
final String? _alias;
|
|
Notes(this.attachedDatabase, [this._alias]);
|
|
late final GeneratedColumn<String> title = GeneratedColumn<String>(
|
|
'title', aliasedName, false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
$customConstraints: '');
|
|
late final GeneratedColumn<String> content = GeneratedColumn<String>(
|
|
'content', aliasedName, false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
$customConstraints: '');
|
|
late final GeneratedColumn<String> searchTerms = GeneratedColumn<String>(
|
|
'search_terms', aliasedName, false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
$customConstraints: '');
|
|
@override
|
|
List<GeneratedColumn> get $columns => [title, content, searchTerms];
|
|
@override
|
|
String get aliasedName => _alias ?? actualTableName;
|
|
@override
|
|
String get actualTableName => $name;
|
|
static const String $name = 'notes';
|
|
@override
|
|
Set<GeneratedColumn> get $primaryKey => const {};
|
|
@override
|
|
NotesData map(Map<String, dynamic> data, {String? tablePrefix}) {
|
|
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
|
return NotesData(
|
|
title: attachedDatabase.typeMapping
|
|
.read(DriftSqlType.string, data['${effectivePrefix}title'])!,
|
|
content: attachedDatabase.typeMapping
|
|
.read(DriftSqlType.string, data['${effectivePrefix}content'])!,
|
|
searchTerms: attachedDatabase.typeMapping
|
|
.read(DriftSqlType.string, data['${effectivePrefix}search_terms'])!,
|
|
);
|
|
}
|
|
|
|
@override
|
|
Notes createAlias(String alias) {
|
|
return Notes(attachedDatabase, alias);
|
|
}
|
|
|
|
@override
|
|
String get moduleAndArgs =>
|
|
'fts5(title, content, search_terms, tokenize = "unicode61 tokenchars \'.\'")';
|
|
}
|
|
|
|
class NotesData extends DataClass implements Insertable<NotesData> {
|
|
final String title;
|
|
final String content;
|
|
final String searchTerms;
|
|
const NotesData(
|
|
{required this.title, required this.content, required this.searchTerms});
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
map['title'] = Variable<String>(title);
|
|
map['content'] = Variable<String>(content);
|
|
map['search_terms'] = Variable<String>(searchTerms);
|
|
return map;
|
|
}
|
|
|
|
NotesCompanion toCompanion(bool nullToAbsent) {
|
|
return NotesCompanion(
|
|
title: Value(title),
|
|
content: Value(content),
|
|
searchTerms: Value(searchTerms),
|
|
);
|
|
}
|
|
|
|
factory NotesData.fromJson(Map<String, dynamic> json,
|
|
{ValueSerializer? serializer}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return NotesData(
|
|
title: serializer.fromJson<String>(json['title']),
|
|
content: serializer.fromJson<String>(json['content']),
|
|
searchTerms: serializer.fromJson<String>(json['searchTerms']),
|
|
);
|
|
}
|
|
@override
|
|
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return <String, dynamic>{
|
|
'title': serializer.toJson<String>(title),
|
|
'content': serializer.toJson<String>(content),
|
|
'searchTerms': serializer.toJson<String>(searchTerms),
|
|
};
|
|
}
|
|
|
|
NotesData copyWith({String? title, String? content, String? searchTerms}) =>
|
|
NotesData(
|
|
title: title ?? this.title,
|
|
content: content ?? this.content,
|
|
searchTerms: searchTerms ?? this.searchTerms,
|
|
);
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('NotesData(')
|
|
..write('title: $title, ')
|
|
..write('content: $content, ')
|
|
..write('searchTerms: $searchTerms')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
|
|
@override
|
|
int get hashCode => Object.hash(title, content, searchTerms);
|
|
@override
|
|
bool operator ==(Object other) =>
|
|
identical(this, other) ||
|
|
(other is NotesData &&
|
|
other.title == this.title &&
|
|
other.content == this.content &&
|
|
other.searchTerms == this.searchTerms);
|
|
}
|
|
|
|
class NotesCompanion extends UpdateCompanion<NotesData> {
|
|
final Value<String> title;
|
|
final Value<String> content;
|
|
final Value<String> searchTerms;
|
|
final Value<int> rowid;
|
|
const NotesCompanion({
|
|
this.title = const Value.absent(),
|
|
this.content = const Value.absent(),
|
|
this.searchTerms = const Value.absent(),
|
|
this.rowid = const Value.absent(),
|
|
});
|
|
NotesCompanion.insert({
|
|
required String title,
|
|
required String content,
|
|
required String searchTerms,
|
|
this.rowid = const Value.absent(),
|
|
}) : title = Value(title),
|
|
content = Value(content),
|
|
searchTerms = Value(searchTerms);
|
|
static Insertable<NotesData> custom({
|
|
Expression<String>? title,
|
|
Expression<String>? content,
|
|
Expression<String>? searchTerms,
|
|
Expression<int>? rowid,
|
|
}) {
|
|
return RawValuesInsertable({
|
|
if (title != null) 'title': title,
|
|
if (content != null) 'content': content,
|
|
if (searchTerms != null) 'search_terms': searchTerms,
|
|
if (rowid != null) 'rowid': rowid,
|
|
});
|
|
}
|
|
|
|
NotesCompanion copyWith(
|
|
{Value<String>? title,
|
|
Value<String>? content,
|
|
Value<String>? searchTerms,
|
|
Value<int>? rowid}) {
|
|
return NotesCompanion(
|
|
title: title ?? this.title,
|
|
content: content ?? this.content,
|
|
searchTerms: searchTerms ?? this.searchTerms,
|
|
rowid: rowid ?? this.rowid,
|
|
);
|
|
}
|
|
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
if (title.present) {
|
|
map['title'] = Variable<String>(title.value);
|
|
}
|
|
if (content.present) {
|
|
map['content'] = Variable<String>(content.value);
|
|
}
|
|
if (searchTerms.present) {
|
|
map['search_terms'] = Variable<String>(searchTerms.value);
|
|
}
|
|
if (rowid.present) {
|
|
map['rowid'] = Variable<int>(rowid.value);
|
|
}
|
|
return map;
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('NotesCompanion(')
|
|
..write('title: $title, ')
|
|
..write('content: $content, ')
|
|
..write('searchTerms: $searchTerms, ')
|
|
..write('rowid: $rowid')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
}
|
|
|
|
class DatabaseAtV8 extends GeneratedDatabase {
|
|
DatabaseAtV8(QueryExecutor e) : super(e);
|
|
late final Users users = Users(this);
|
|
late final Groups groups = Groups(this);
|
|
late final GroupCount groupCount = GroupCount(this);
|
|
late final Notes notes = Notes(this);
|
|
@override
|
|
Iterable<TableInfo<Table, Object?>> get allTables =>
|
|
allSchemaEntities.whereType<TableInfo<Table, Object?>>();
|
|
@override
|
|
List<DatabaseSchemaEntity> get allSchemaEntities =>
|
|
[users, groups, groupCount, notes];
|
|
@override
|
|
int get schemaVersion => 8;
|
|
@override
|
|
DriftDatabaseOptions get options =>
|
|
const DriftDatabaseOptions(storeDateTimeAsText: true);
|
|
}
|