platform/angel_orm_generator/test/models/fruit.g.dart

111 lines
2.7 KiB
Dart
Raw Normal View History

2018-08-24 13:42:09 +00:00
// GENERATED CODE - DO NOT MODIFY BY HAND
part of angel_orm_generator.test.models.fruit;
2018-12-01 19:03:43 +00:00
// **************************************************************************
// OrmGenerator
// **************************************************************************
class FruitQuery extends Query<Fruit, FruitQueryWhere> {
@override
final FruitQueryWhere where = new FruitQueryWhere();
@override
get tableName {
return 'fruits';
}
@override
get fields {
return const ['id', 'treeId', 'commonName', 'createdAt', 'updatedAt'];
}
@override
deserialize(List row) {
return new Fruit(
id: (row[0] as String),
treeId: (row[0] as int),
commonName: (row[0] as String),
createdAt: (row[0] as DateTime),
updatedAt: (row[0] as DateTime));
}
}
class FruitQueryWhere extends QueryWhere {
final StringSqlExpressionBuilder id = new StringSqlExpressionBuilder('id');
final NumericSqlExpressionBuilder<int> treeId =
new NumericSqlExpressionBuilder<int>('tree_id');
final StringSqlExpressionBuilder commonName =
new StringSqlExpressionBuilder('common_name');
final DateTimeSqlExpressionBuilder createdAt =
new DateTimeSqlExpressionBuilder('created_at');
final DateTimeSqlExpressionBuilder updatedAt =
new DateTimeSqlExpressionBuilder('updated_at');
@override
get expressionBuilders {
return [id, treeId, commonName, createdAt, updatedAt];
}
}
2018-08-24 13:42:09 +00:00
// **************************************************************************
// JsonModelGenerator
// **************************************************************************
@generatedSerializable
class Fruit extends _Fruit {
Fruit(
{this.id, this.treeId, this.commonName, this.createdAt, this.updatedAt});
@override
final String id;
@override
final int treeId;
@override
final String commonName;
@override
final DateTime createdAt;
@override
final DateTime updatedAt;
Fruit copyWith(
{String id,
int treeId,
String commonName,
DateTime createdAt,
DateTime updatedAt}) {
return new Fruit(
id: id ?? this.id,
treeId: treeId ?? this.treeId,
commonName: commonName ?? this.commonName,
createdAt: createdAt ?? this.createdAt,
updatedAt: updatedAt ?? this.updatedAt);
}
bool operator ==(other) {
return other is _Fruit &&
other.id == id &&
other.treeId == treeId &&
other.commonName == commonName &&
other.createdAt == createdAt &&
other.updatedAt == updatedAt;
}
2018-12-01 19:03:43 +00:00
@override
int get hashCode {
return hashObjects([id, treeId, commonName, createdAt, updatedAt]);
}
2018-08-24 13:42:09 +00:00
Map<String, dynamic> toJson() {
return FruitSerializer.toMap(this);
}
}