mirror of https://github.com/AMT-Cheif/drift.git
Migrate remaining examples to null-safety
This commit is contained in:
parent
52c07c9d3f
commit
a064bb719d
|
@ -10,36 +10,33 @@ part of 'database.dart';
|
||||||
class User extends DataClass implements Insertable<User> {
|
class User extends DataClass implements Insertable<User> {
|
||||||
final int id;
|
final int id;
|
||||||
final String name;
|
final String name;
|
||||||
User({@required this.id, @required this.name});
|
User({required this.id, required this.name});
|
||||||
factory User.fromData(Map<String, dynamic> data, {String prefix}) {
|
factory User.fromData(Map<String, dynamic> data, {String? prefix}) {
|
||||||
final effectivePrefix = prefix ?? '';
|
final effectivePrefix = prefix ?? '';
|
||||||
return User(
|
return User(
|
||||||
id: const IntType().mapFromDatabaseResponse(data['${effectivePrefix}id']),
|
id: const IntType()
|
||||||
|
.mapFromDatabaseResponse(data['${effectivePrefix}id'])!,
|
||||||
name: const StringType()
|
name: const StringType()
|
||||||
.mapFromDatabaseResponse(data['${effectivePrefix}name']),
|
.mapFromDatabaseResponse(data['${effectivePrefix}name'])!,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@override
|
@override
|
||||||
Map<String, Expression> toColumns(bool nullToAbsent) {
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
||||||
final map = <String, Expression>{};
|
final map = <String, Expression>{};
|
||||||
if (!nullToAbsent || id != null) {
|
map['id'] = Variable<int>(id);
|
||||||
map['id'] = Variable<int>(id);
|
map['name'] = Variable<String>(name);
|
||||||
}
|
|
||||||
if (!nullToAbsent || name != null) {
|
|
||||||
map['name'] = Variable<String>(name);
|
|
||||||
}
|
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
UsersCompanion toCompanion(bool nullToAbsent) {
|
UsersCompanion toCompanion(bool nullToAbsent) {
|
||||||
return UsersCompanion(
|
return UsersCompanion(
|
||||||
id: id == null && nullToAbsent ? const Value.absent() : Value(id),
|
id: Value(id),
|
||||||
name: name == null && nullToAbsent ? const Value.absent() : Value(name),
|
name: Value(name),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
factory User.fromJson(Map<String, dynamic> json,
|
factory User.fromJson(Map<String, dynamic> json,
|
||||||
{ValueSerializer serializer}) {
|
{ValueSerializer? serializer}) {
|
||||||
serializer ??= driftRuntimeOptions.defaultSerializer;
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
||||||
return User(
|
return User(
|
||||||
id: serializer.fromJson<int>(json['id']),
|
id: serializer.fromJson<int>(json['id']),
|
||||||
|
@ -47,7 +44,7 @@ class User extends DataClass implements Insertable<User> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@override
|
@override
|
||||||
Map<String, dynamic> toJson({ValueSerializer serializer}) {
|
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
|
||||||
serializer ??= driftRuntimeOptions.defaultSerializer;
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
||||||
return <String, dynamic>{
|
return <String, dynamic>{
|
||||||
'id': serializer.toJson<int>(id),
|
'id': serializer.toJson<int>(id),
|
||||||
|
@ -55,7 +52,7 @@ class User extends DataClass implements Insertable<User> {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
User copyWith({int id, String name}) => User(
|
User copyWith({int? id, String? name}) => User(
|
||||||
id: id ?? this.id,
|
id: id ?? this.id,
|
||||||
name: name ?? this.name,
|
name: name ?? this.name,
|
||||||
);
|
);
|
||||||
|
@ -85,11 +82,11 @@ class UsersCompanion extends UpdateCompanion<User> {
|
||||||
});
|
});
|
||||||
UsersCompanion.insert({
|
UsersCompanion.insert({
|
||||||
this.id = const Value.absent(),
|
this.id = const Value.absent(),
|
||||||
@required String name,
|
required String name,
|
||||||
}) : name = Value(name);
|
}) : name = Value(name);
|
||||||
static Insertable<User> custom({
|
static Insertable<User> custom({
|
||||||
Expression<int> id,
|
Expression<int>? id,
|
||||||
Expression<String> name,
|
Expression<String>? name,
|
||||||
}) {
|
}) {
|
||||||
return RawValuesInsertable({
|
return RawValuesInsertable({
|
||||||
if (id != null) 'id': id,
|
if (id != null) 'id': id,
|
||||||
|
@ -97,7 +94,7 @@ class UsersCompanion extends UpdateCompanion<User> {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
UsersCompanion copyWith({Value<int> id, Value<String> name}) {
|
UsersCompanion copyWith({Value<int>? id, Value<String>? name}) {
|
||||||
return UsersCompanion(
|
return UsersCompanion(
|
||||||
id: id ?? this.id,
|
id: id ?? this.id,
|
||||||
name: name ?? this.name,
|
name: name ?? this.name,
|
||||||
|
@ -129,22 +126,20 @@ class UsersCompanion extends UpdateCompanion<User> {
|
||||||
class Users extends Table with TableInfo<Users, User> {
|
class Users extends Table with TableInfo<Users, User> {
|
||||||
@override
|
@override
|
||||||
final GeneratedDatabase attachedDatabase;
|
final GeneratedDatabase attachedDatabase;
|
||||||
final String _alias;
|
final String? _alias;
|
||||||
Users(this.attachedDatabase, [this._alias]);
|
Users(this.attachedDatabase, [this._alias]);
|
||||||
final VerificationMeta _idMeta = const VerificationMeta('id');
|
final VerificationMeta _idMeta = const VerificationMeta('id');
|
||||||
GeneratedColumn<int> _id;
|
late final GeneratedColumn<int?> id = GeneratedColumn<int?>(
|
||||||
GeneratedColumn<int> get id =>
|
'id', aliasedName, false,
|
||||||
_id ??= GeneratedColumn<int>('id', aliasedName, false,
|
type: const IntType(),
|
||||||
type: const IntType(),
|
requiredDuringInsert: false,
|
||||||
requiredDuringInsert: false,
|
$customConstraints: 'NOT NULL PRIMARY KEY AUTOINCREMENT');
|
||||||
$customConstraints: 'NOT NULL PRIMARY KEY AUTOINCREMENT');
|
|
||||||
final VerificationMeta _nameMeta = const VerificationMeta('name');
|
final VerificationMeta _nameMeta = const VerificationMeta('name');
|
||||||
GeneratedColumn<String> _name;
|
late final GeneratedColumn<String?> name = GeneratedColumn<String?>(
|
||||||
GeneratedColumn<String> get name =>
|
'name', aliasedName, false,
|
||||||
_name ??= GeneratedColumn<String>('name', aliasedName, false,
|
type: const StringType(),
|
||||||
type: const StringType(),
|
requiredDuringInsert: true,
|
||||||
requiredDuringInsert: true,
|
$customConstraints: 'NOT NULL');
|
||||||
$customConstraints: 'NOT NULL');
|
|
||||||
@override
|
@override
|
||||||
List<GeneratedColumn> get $columns => [id, name];
|
List<GeneratedColumn> get $columns => [id, name];
|
||||||
@override
|
@override
|
||||||
|
@ -157,11 +152,11 @@ class Users extends Table with TableInfo<Users, User> {
|
||||||
final context = VerificationContext();
|
final context = VerificationContext();
|
||||||
final data = instance.toColumns(true);
|
final data = instance.toColumns(true);
|
||||||
if (data.containsKey('id')) {
|
if (data.containsKey('id')) {
|
||||||
context.handle(_idMeta, id.isAcceptableOrUnknown(data['id'], _idMeta));
|
context.handle(_idMeta, id.isAcceptableOrUnknown(data['id']!, _idMeta));
|
||||||
}
|
}
|
||||||
if (data.containsKey('name')) {
|
if (data.containsKey('name')) {
|
||||||
context.handle(
|
context.handle(
|
||||||
_nameMeta, name.isAcceptableOrUnknown(data['name'], _nameMeta));
|
_nameMeta, name.isAcceptableOrUnknown(data['name']!, _nameMeta));
|
||||||
} else if (isInserting) {
|
} else if (isInserting) {
|
||||||
context.missing(_nameMeta);
|
context.missing(_nameMeta);
|
||||||
}
|
}
|
||||||
|
@ -171,7 +166,7 @@ class Users extends Table with TableInfo<Users, User> {
|
||||||
@override
|
@override
|
||||||
Set<GeneratedColumn> get $primaryKey => {id};
|
Set<GeneratedColumn> get $primaryKey => {id};
|
||||||
@override
|
@override
|
||||||
User map(Map<String, dynamic> data, {String tablePrefix}) {
|
User map(Map<String, dynamic> data, {String? tablePrefix}) {
|
||||||
return User.fromData(data,
|
return User.fromData(data,
|
||||||
prefix: tablePrefix != null ? '$tablePrefix.' : null);
|
prefix: tablePrefix != null ? '$tablePrefix.' : null);
|
||||||
}
|
}
|
||||||
|
@ -187,8 +182,7 @@ class Users extends Table with TableInfo<Users, User> {
|
||||||
|
|
||||||
abstract class _$Database extends GeneratedDatabase {
|
abstract class _$Database extends GeneratedDatabase {
|
||||||
_$Database(QueryExecutor e) : super(SqlTypeSystem.defaultInstance, e);
|
_$Database(QueryExecutor e) : super(SqlTypeSystem.defaultInstance, e);
|
||||||
Users _users;
|
late final Users users = Users(this);
|
||||||
Users get users => _users ??= Users(this);
|
|
||||||
@override
|
@override
|
||||||
Iterable<TableInfo> get allTables => allSchemaEntities.whereType<TableInfo>();
|
Iterable<TableInfo> get allTables => allSchemaEntities.whereType<TableInfo>();
|
||||||
@override
|
@override
|
||||||
|
|
|
@ -10,10 +10,10 @@ class _$Foo extends Foo {
|
||||||
@override
|
@override
|
||||||
final User moorField;
|
final User moorField;
|
||||||
|
|
||||||
factory _$Foo([void Function(FooBuilder) updates]) =>
|
factory _$Foo([void Function(FooBuilder)? updates]) =>
|
||||||
(new FooBuilder()..update(updates))._build();
|
(new FooBuilder()..update(updates))._build();
|
||||||
|
|
||||||
_$Foo._({this.moorField}) : super._() {
|
_$Foo._({required this.moorField}) : super._() {
|
||||||
BuiltValueNullFieldError.checkNotNull(moorField, r'Foo', 'moorField');
|
BuiltValueNullFieldError.checkNotNull(moorField, r'Foo', 'moorField');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,11 +43,11 @@ class _$Foo extends Foo {
|
||||||
}
|
}
|
||||||
|
|
||||||
class FooBuilder implements Builder<Foo, FooBuilder> {
|
class FooBuilder implements Builder<Foo, FooBuilder> {
|
||||||
_$Foo _$v;
|
_$Foo? _$v;
|
||||||
|
|
||||||
User _moorField;
|
User? _moorField;
|
||||||
User get moorField => _$this._moorField;
|
User? get moorField => _$this._moorField;
|
||||||
set moorField(User moorField) => _$this._moorField = moorField;
|
set moorField(User? moorField) => _$this._moorField = moorField;
|
||||||
|
|
||||||
FooBuilder();
|
FooBuilder();
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ class FooBuilder implements Builder<Foo, FooBuilder> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void update(void Function(FooBuilder) updates) {
|
void update(void Function(FooBuilder)? updates) {
|
||||||
if (updates != null) updates(this);
|
if (updates != null) updates(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,14 +3,14 @@ publish_to: none
|
||||||
version: 1.0.0
|
version: 1.0.0
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: '>=2.6.0 <3.0.0'
|
sdk: '>=2.12.0 <3.0.0'
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
drift: ^1.0.0
|
drift: ^2.0.0-dev
|
||||||
built_value: ^8.0.0
|
built_value: ^8.0.0
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
drift_dev: ^1.0.0
|
drift_dev: ^2.0.0-dev
|
||||||
built_value_generator: ^8.1.1
|
built_value_generator: ^8.1.1
|
||||||
build_runner: ^2.0.0
|
build_runner: ^2.0.0
|
||||||
|
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
name: web
|
name: web
|
||||||
description: Run integration tests for Moor on the web
|
description: Run integration tests for Moor on the web
|
||||||
environment:
|
environment:
|
||||||
sdk: '>=2.6.0 <3.0.0'
|
sdk: '>=2.12.0 <3.0.0'
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
drift:
|
drift: ^2.0.0-dev
|
||||||
drift_testcases:
|
drift_testcases:
|
||||||
path: ../drift_testcases
|
path: ../drift_testcases
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
test: ^1.5.0
|
test: ^1.18.0
|
||||||
build_runner:
|
build_runner:
|
||||||
build_web_compilers:
|
build_web_compilers:
|
||||||
drift_dev: ^1.0.0
|
drift_dev: ^2.0.0-dev
|
||||||
|
|
||||||
dependency_overrides:
|
dependency_overrides:
|
||||||
drift:
|
drift:
|
||||||
|
|
|
@ -9,44 +9,43 @@ part of 'saves_after_migration_regression_test.dart';
|
||||||
// ignore_for_file: type=lint
|
// ignore_for_file: type=lint
|
||||||
class Foo extends DataClass implements Insertable<Foo> {
|
class Foo extends DataClass implements Insertable<Foo> {
|
||||||
final int id;
|
final int id;
|
||||||
Foo({@required this.id});
|
Foo({required this.id});
|
||||||
factory Foo.fromData(Map<String, dynamic> data, {String prefix}) {
|
factory Foo.fromData(Map<String, dynamic> data, {String? prefix}) {
|
||||||
final effectivePrefix = prefix ?? '';
|
final effectivePrefix = prefix ?? '';
|
||||||
return Foo(
|
return Foo(
|
||||||
id: const IntType().mapFromDatabaseResponse(data['${effectivePrefix}id']),
|
id: const IntType()
|
||||||
|
.mapFromDatabaseResponse(data['${effectivePrefix}id'])!,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@override
|
@override
|
||||||
Map<String, Expression> toColumns(bool nullToAbsent) {
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
||||||
final map = <String, Expression>{};
|
final map = <String, Expression>{};
|
||||||
if (!nullToAbsent || id != null) {
|
map['id'] = Variable<int>(id);
|
||||||
map['id'] = Variable<int>(id);
|
|
||||||
}
|
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
FoosCompanion toCompanion(bool nullToAbsent) {
|
FoosCompanion toCompanion(bool nullToAbsent) {
|
||||||
return FoosCompanion(
|
return FoosCompanion(
|
||||||
id: id == null && nullToAbsent ? const Value.absent() : Value(id),
|
id: Value(id),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
factory Foo.fromJson(Map<String, dynamic> json,
|
factory Foo.fromJson(Map<String, dynamic> json,
|
||||||
{ValueSerializer serializer}) {
|
{ValueSerializer? serializer}) {
|
||||||
serializer ??= driftRuntimeOptions.defaultSerializer;
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
||||||
return Foo(
|
return Foo(
|
||||||
id: serializer.fromJson<int>(json['id']),
|
id: serializer.fromJson<int>(json['id']),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@override
|
@override
|
||||||
Map<String, dynamic> toJson({ValueSerializer serializer}) {
|
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
|
||||||
serializer ??= driftRuntimeOptions.defaultSerializer;
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
||||||
return <String, dynamic>{
|
return <String, dynamic>{
|
||||||
'id': serializer.toJson<int>(id),
|
'id': serializer.toJson<int>(id),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
Foo copyWith({int id}) => Foo(
|
Foo copyWith({int? id}) => Foo(
|
||||||
id: id ?? this.id,
|
id: id ?? this.id,
|
||||||
);
|
);
|
||||||
@override
|
@override
|
||||||
|
@ -73,14 +72,14 @@ class FoosCompanion extends UpdateCompanion<Foo> {
|
||||||
this.id = const Value.absent(),
|
this.id = const Value.absent(),
|
||||||
});
|
});
|
||||||
static Insertable<Foo> custom({
|
static Insertable<Foo> custom({
|
||||||
Expression<int> id,
|
Expression<int>? id,
|
||||||
}) {
|
}) {
|
||||||
return RawValuesInsertable({
|
return RawValuesInsertable({
|
||||||
if (id != null) 'id': id,
|
if (id != null) 'id': id,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
FoosCompanion copyWith({Value<int> id}) {
|
FoosCompanion copyWith({Value<int>? id}) {
|
||||||
return FoosCompanion(
|
return FoosCompanion(
|
||||||
id: id ?? this.id,
|
id: id ?? this.id,
|
||||||
);
|
);
|
||||||
|
@ -107,16 +106,15 @@ class FoosCompanion extends UpdateCompanion<Foo> {
|
||||||
class $FoosTable extends Foos with TableInfo<$FoosTable, Foo> {
|
class $FoosTable extends Foos with TableInfo<$FoosTable, Foo> {
|
||||||
@override
|
@override
|
||||||
final GeneratedDatabase attachedDatabase;
|
final GeneratedDatabase attachedDatabase;
|
||||||
final String _alias;
|
final String? _alias;
|
||||||
$FoosTable(this.attachedDatabase, [this._alias]);
|
$FoosTable(this.attachedDatabase, [this._alias]);
|
||||||
final VerificationMeta _idMeta = const VerificationMeta('id');
|
final VerificationMeta _idMeta = const VerificationMeta('id');
|
||||||
GeneratedColumn<int> _id;
|
|
||||||
@override
|
@override
|
||||||
GeneratedColumn<int> get id =>
|
late final GeneratedColumn<int?> id = GeneratedColumn<int?>(
|
||||||
_id ??= GeneratedColumn<int>('id', aliasedName, false,
|
'id', aliasedName, false,
|
||||||
type: const IntType(),
|
type: const IntType(),
|
||||||
requiredDuringInsert: false,
|
requiredDuringInsert: false,
|
||||||
defaultConstraints: 'PRIMARY KEY AUTOINCREMENT');
|
defaultConstraints: 'PRIMARY KEY AUTOINCREMENT');
|
||||||
@override
|
@override
|
||||||
List<GeneratedColumn> get $columns => [id];
|
List<GeneratedColumn> get $columns => [id];
|
||||||
@override
|
@override
|
||||||
|
@ -129,7 +127,7 @@ class $FoosTable extends Foos with TableInfo<$FoosTable, Foo> {
|
||||||
final context = VerificationContext();
|
final context = VerificationContext();
|
||||||
final data = instance.toColumns(true);
|
final data = instance.toColumns(true);
|
||||||
if (data.containsKey('id')) {
|
if (data.containsKey('id')) {
|
||||||
context.handle(_idMeta, id.isAcceptableOrUnknown(data['id'], _idMeta));
|
context.handle(_idMeta, id.isAcceptableOrUnknown(data['id']!, _idMeta));
|
||||||
}
|
}
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
@ -137,7 +135,7 @@ class $FoosTable extends Foos with TableInfo<$FoosTable, Foo> {
|
||||||
@override
|
@override
|
||||||
Set<GeneratedColumn> get $primaryKey => {id};
|
Set<GeneratedColumn> get $primaryKey => {id};
|
||||||
@override
|
@override
|
||||||
Foo map(Map<String, dynamic> data, {String tablePrefix}) {
|
Foo map(Map<String, dynamic> data, {String? tablePrefix}) {
|
||||||
return Foo.fromData(data,
|
return Foo.fromData(data,
|
||||||
prefix: tablePrefix != null ? '$tablePrefix.' : null);
|
prefix: tablePrefix != null ? '$tablePrefix.' : null);
|
||||||
}
|
}
|
||||||
|
@ -150,44 +148,43 @@ class $FoosTable extends Foos with TableInfo<$FoosTable, Foo> {
|
||||||
|
|
||||||
class Bar extends DataClass implements Insertable<Bar> {
|
class Bar extends DataClass implements Insertable<Bar> {
|
||||||
final int id;
|
final int id;
|
||||||
Bar({@required this.id});
|
Bar({required this.id});
|
||||||
factory Bar.fromData(Map<String, dynamic> data, {String prefix}) {
|
factory Bar.fromData(Map<String, dynamic> data, {String? prefix}) {
|
||||||
final effectivePrefix = prefix ?? '';
|
final effectivePrefix = prefix ?? '';
|
||||||
return Bar(
|
return Bar(
|
||||||
id: const IntType().mapFromDatabaseResponse(data['${effectivePrefix}id']),
|
id: const IntType()
|
||||||
|
.mapFromDatabaseResponse(data['${effectivePrefix}id'])!,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@override
|
@override
|
||||||
Map<String, Expression> toColumns(bool nullToAbsent) {
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
||||||
final map = <String, Expression>{};
|
final map = <String, Expression>{};
|
||||||
if (!nullToAbsent || id != null) {
|
map['id'] = Variable<int>(id);
|
||||||
map['id'] = Variable<int>(id);
|
|
||||||
}
|
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
BarsCompanion toCompanion(bool nullToAbsent) {
|
BarsCompanion toCompanion(bool nullToAbsent) {
|
||||||
return BarsCompanion(
|
return BarsCompanion(
|
||||||
id: id == null && nullToAbsent ? const Value.absent() : Value(id),
|
id: Value(id),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
factory Bar.fromJson(Map<String, dynamic> json,
|
factory Bar.fromJson(Map<String, dynamic> json,
|
||||||
{ValueSerializer serializer}) {
|
{ValueSerializer? serializer}) {
|
||||||
serializer ??= driftRuntimeOptions.defaultSerializer;
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
||||||
return Bar(
|
return Bar(
|
||||||
id: serializer.fromJson<int>(json['id']),
|
id: serializer.fromJson<int>(json['id']),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@override
|
@override
|
||||||
Map<String, dynamic> toJson({ValueSerializer serializer}) {
|
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
|
||||||
serializer ??= driftRuntimeOptions.defaultSerializer;
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
||||||
return <String, dynamic>{
|
return <String, dynamic>{
|
||||||
'id': serializer.toJson<int>(id),
|
'id': serializer.toJson<int>(id),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
Bar copyWith({int id}) => Bar(
|
Bar copyWith({int? id}) => Bar(
|
||||||
id: id ?? this.id,
|
id: id ?? this.id,
|
||||||
);
|
);
|
||||||
@override
|
@override
|
||||||
|
@ -214,14 +211,14 @@ class BarsCompanion extends UpdateCompanion<Bar> {
|
||||||
this.id = const Value.absent(),
|
this.id = const Value.absent(),
|
||||||
});
|
});
|
||||||
static Insertable<Bar> custom({
|
static Insertable<Bar> custom({
|
||||||
Expression<int> id,
|
Expression<int>? id,
|
||||||
}) {
|
}) {
|
||||||
return RawValuesInsertable({
|
return RawValuesInsertable({
|
||||||
if (id != null) 'id': id,
|
if (id != null) 'id': id,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
BarsCompanion copyWith({Value<int> id}) {
|
BarsCompanion copyWith({Value<int>? id}) {
|
||||||
return BarsCompanion(
|
return BarsCompanion(
|
||||||
id: id ?? this.id,
|
id: id ?? this.id,
|
||||||
);
|
);
|
||||||
|
@ -248,16 +245,15 @@ class BarsCompanion extends UpdateCompanion<Bar> {
|
||||||
class $BarsTable extends Bars with TableInfo<$BarsTable, Bar> {
|
class $BarsTable extends Bars with TableInfo<$BarsTable, Bar> {
|
||||||
@override
|
@override
|
||||||
final GeneratedDatabase attachedDatabase;
|
final GeneratedDatabase attachedDatabase;
|
||||||
final String _alias;
|
final String? _alias;
|
||||||
$BarsTable(this.attachedDatabase, [this._alias]);
|
$BarsTable(this.attachedDatabase, [this._alias]);
|
||||||
final VerificationMeta _idMeta = const VerificationMeta('id');
|
final VerificationMeta _idMeta = const VerificationMeta('id');
|
||||||
GeneratedColumn<int> _id;
|
|
||||||
@override
|
@override
|
||||||
GeneratedColumn<int> get id =>
|
late final GeneratedColumn<int?> id = GeneratedColumn<int?>(
|
||||||
_id ??= GeneratedColumn<int>('id', aliasedName, false,
|
'id', aliasedName, false,
|
||||||
type: const IntType(),
|
type: const IntType(),
|
||||||
requiredDuringInsert: false,
|
requiredDuringInsert: false,
|
||||||
defaultConstraints: 'PRIMARY KEY AUTOINCREMENT');
|
defaultConstraints: 'PRIMARY KEY AUTOINCREMENT');
|
||||||
@override
|
@override
|
||||||
List<GeneratedColumn> get $columns => [id];
|
List<GeneratedColumn> get $columns => [id];
|
||||||
@override
|
@override
|
||||||
|
@ -270,7 +266,7 @@ class $BarsTable extends Bars with TableInfo<$BarsTable, Bar> {
|
||||||
final context = VerificationContext();
|
final context = VerificationContext();
|
||||||
final data = instance.toColumns(true);
|
final data = instance.toColumns(true);
|
||||||
if (data.containsKey('id')) {
|
if (data.containsKey('id')) {
|
||||||
context.handle(_idMeta, id.isAcceptableOrUnknown(data['id'], _idMeta));
|
context.handle(_idMeta, id.isAcceptableOrUnknown(data['id']!, _idMeta));
|
||||||
}
|
}
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
@ -278,7 +274,7 @@ class $BarsTable extends Bars with TableInfo<$BarsTable, Bar> {
|
||||||
@override
|
@override
|
||||||
Set<GeneratedColumn> get $primaryKey => {id};
|
Set<GeneratedColumn> get $primaryKey => {id};
|
||||||
@override
|
@override
|
||||||
Bar map(Map<String, dynamic> data, {String tablePrefix}) {
|
Bar map(Map<String, dynamic> data, {String? tablePrefix}) {
|
||||||
return Bar.fromData(data,
|
return Bar.fromData(data,
|
||||||
prefix: tablePrefix != null ? '$tablePrefix.' : null);
|
prefix: tablePrefix != null ? '$tablePrefix.' : null);
|
||||||
}
|
}
|
||||||
|
@ -291,10 +287,8 @@ class $BarsTable extends Bars with TableInfo<$BarsTable, Bar> {
|
||||||
|
|
||||||
abstract class _$_FakeDb extends GeneratedDatabase {
|
abstract class _$_FakeDb extends GeneratedDatabase {
|
||||||
_$_FakeDb(QueryExecutor e) : super(SqlTypeSystem.defaultInstance, e);
|
_$_FakeDb(QueryExecutor e) : super(SqlTypeSystem.defaultInstance, e);
|
||||||
$FoosTable _foos;
|
late final $FoosTable foos = $FoosTable(this);
|
||||||
$FoosTable get foos => _foos ??= $FoosTable(this);
|
late final $BarsTable bars = $BarsTable(this);
|
||||||
$BarsTable _bars;
|
|
||||||
$BarsTable get bars => _bars ??= $BarsTable(this);
|
|
||||||
@override
|
@override
|
||||||
Iterable<TableInfo> get allTables => allSchemaEntities.whereType<TableInfo>();
|
Iterable<TableInfo> get allTables => allSchemaEntities.whereType<TableInfo>();
|
||||||
@override
|
@override
|
||||||
|
|
Loading…
Reference in New Issue