diff --git a/angel_orm_generator/build.yaml b/angel_orm_generator/build.yaml index 41b9c97e..4967a098 100644 --- a/angel_orm_generator/build.yaml +++ b/angel_orm_generator/build.yaml @@ -4,7 +4,7 @@ builders: builder_factories: - ormBuilder auto_apply: root_package - build_to: source + build_to: cache build_extensions: .dart: - ".angel_orm.g.part" diff --git a/angel_orm_generator/test/models/author.dart b/angel_orm_generator/test/models/author.dart index ed045366..9a8a0a8e 100644 --- a/angel_orm_generator/test/models/author.dart +++ b/angel_orm_generator/test/models/author.dart @@ -3,11 +3,8 @@ library angel_orm.generator.models.author; import 'package:angel_model/angel_model.dart'; import 'package:angel_orm/angel_orm.dart'; import 'package:angel_serialize/angel_serialize.dart'; - part 'author.g.dart'; -part 'author.serializer.g.dart'; - @serializable @orm class _Author extends Model { diff --git a/angel_orm_generator/test/models/author.g.dart b/angel_orm_generator/test/models/author.g.dart index 65f37a20..48c91e9c 100644 --- a/angel_orm_generator/test/models/author.g.dart +++ b/angel_orm_generator/test/models/author.g.dart @@ -139,3 +139,54 @@ class Author extends _Author { return AuthorSerializer.toMap(this); } } + +// ************************************************************************** +// SerializerGenerator +// ************************************************************************** + +abstract class AuthorSerializer { + static Author fromMap(Map map) { + return new Author( + id: map['id'] as String, + name: map['name'] as String, + createdAt: map['created_at'] != null + ? (map['created_at'] is DateTime + ? (map['created_at'] as DateTime) + : DateTime.parse(map['created_at'].toString())) + : null, + updatedAt: map['updated_at'] != null + ? (map['updated_at'] is DateTime + ? (map['updated_at'] as DateTime) + : DateTime.parse(map['updated_at'].toString())) + : null); + } + + static Map toMap(Author model) { + if (model == null) { + return null; + } + return { + 'id': model.id, + 'name': model.name, + 'created_at': model.createdAt?.toIso8601String(), + 'updated_at': model.updatedAt?.toIso8601String() + }; + } +} + +abstract class AuthorFields { + static const List allFields = const [ + id, + name, + createdAt, + updatedAt + ]; + + static const String id = 'id'; + + static const String name = 'name'; + + static const String createdAt = 'created_at'; + + static const String updatedAt = 'updated_at'; +} diff --git a/angel_orm_generator/test/models/author.serializer.g.dart b/angel_orm_generator/test/models/author.serializer.g.dart deleted file mode 100644 index 0ffae031..00000000 --- a/angel_orm_generator/test/models/author.serializer.g.dart +++ /dev/null @@ -1,54 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of angel_orm.generator.models.author; - -// ************************************************************************** -// SerializerGenerator -// ************************************************************************** - -abstract class AuthorSerializer { - static Author fromMap(Map map) { - return new Author( - id: map['id'] as String, - name: map['name'] as String, - createdAt: map['created_at'] != null - ? (map['created_at'] is DateTime - ? (map['created_at'] as DateTime) - : DateTime.parse(map['created_at'].toString())) - : null, - updatedAt: map['updated_at'] != null - ? (map['updated_at'] is DateTime - ? (map['updated_at'] as DateTime) - : DateTime.parse(map['updated_at'].toString())) - : null); - } - - static Map toMap(Author model) { - if (model == null) { - return null; - } - return { - 'id': model.id, - 'name': model.name, - 'created_at': model.createdAt?.toIso8601String(), - 'updated_at': model.updatedAt?.toIso8601String() - }; - } -} - -abstract class AuthorFields { - static const List allFields = const [ - id, - name, - createdAt, - updatedAt - ]; - - static const String id = 'id'; - - static const String name = 'name'; - - static const String createdAt = 'created_at'; - - static const String updatedAt = 'updated_at'; -} diff --git a/angel_orm_generator/test/models/book.dart b/angel_orm_generator/test/models/book.dart index 50094af0..e20b5ea1 100644 --- a/angel_orm_generator/test/models/book.dart +++ b/angel_orm_generator/test/models/book.dart @@ -5,7 +5,6 @@ import 'package:angel_orm/angel_orm.dart'; import 'package:angel_serialize/angel_serialize.dart'; import 'author.dart'; part 'book.g.dart'; -part 'book.serializer.g.dart'; @serializable @orm diff --git a/angel_orm_generator/test/models/book.g.dart b/angel_orm_generator/test/models/book.g.dart index ec996ed8..5446fe37 100644 --- a/angel_orm_generator/test/models/book.g.dart +++ b/angel_orm_generator/test/models/book.g.dart @@ -214,3 +214,68 @@ class Book extends _Book { return BookSerializer.toMap(this); } } + +// ************************************************************************** +// SerializerGenerator +// ************************************************************************** + +abstract class BookSerializer { + static Book fromMap(Map map) { + return new Book( + id: map['id'] as String, + author: map['author'] != null + ? AuthorSerializer.fromMap(map['author'] as Map) + : null, + partnerAuthor: map['partner_author'] != null + ? AuthorSerializer.fromMap(map['partner_author'] as Map) + : null, + name: map['name'] as String, + createdAt: map['created_at'] != null + ? (map['created_at'] is DateTime + ? (map['created_at'] as DateTime) + : DateTime.parse(map['created_at'].toString())) + : null, + updatedAt: map['updated_at'] != null + ? (map['updated_at'] is DateTime + ? (map['updated_at'] as DateTime) + : DateTime.parse(map['updated_at'].toString())) + : null); + } + + static Map toMap(Book model) { + if (model == null) { + return null; + } + return { + 'id': model.id, + 'author': AuthorSerializer.toMap(model.author), + 'partner_author': AuthorSerializer.toMap(model.partnerAuthor), + 'name': model.name, + 'created_at': model.createdAt?.toIso8601String(), + 'updated_at': model.updatedAt?.toIso8601String() + }; + } +} + +abstract class BookFields { + static const List allFields = const [ + id, + author, + partnerAuthor, + name, + createdAt, + updatedAt + ]; + + static const String id = 'id'; + + static const String author = 'author'; + + static const String partnerAuthor = 'partner_author'; + + static const String name = 'name'; + + static const String createdAt = 'created_at'; + + static const String updatedAt = 'updated_at'; +} diff --git a/angel_orm_generator/test/models/book.serializer.g.dart b/angel_orm_generator/test/models/book.serializer.g.dart deleted file mode 100644 index a05db298..00000000 --- a/angel_orm_generator/test/models/book.serializer.g.dart +++ /dev/null @@ -1,68 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of angel_orm.generator.models.book; - -// ************************************************************************** -// SerializerGenerator -// ************************************************************************** - -abstract class BookSerializer { - static Book fromMap(Map map) { - return new Book( - id: map['id'] as String, - author: map['author'] != null - ? AuthorSerializer.fromMap(map['author'] as Map) - : null, - partnerAuthor: map['partner_author'] != null - ? AuthorSerializer.fromMap(map['partner_author'] as Map) - : null, - name: map['name'] as String, - createdAt: map['created_at'] != null - ? (map['created_at'] is DateTime - ? (map['created_at'] as DateTime) - : DateTime.parse(map['created_at'].toString())) - : null, - updatedAt: map['updated_at'] != null - ? (map['updated_at'] is DateTime - ? (map['updated_at'] as DateTime) - : DateTime.parse(map['updated_at'].toString())) - : null); - } - - static Map toMap(Book model) { - if (model == null) { - return null; - } - return { - 'id': model.id, - 'author': AuthorSerializer.toMap(model.author), - 'partner_author': AuthorSerializer.toMap(model.partnerAuthor), - 'name': model.name, - 'created_at': model.createdAt?.toIso8601String(), - 'updated_at': model.updatedAt?.toIso8601String() - }; - } -} - -abstract class BookFields { - static const List allFields = const [ - id, - author, - partnerAuthor, - name, - createdAt, - updatedAt - ]; - - static const String id = 'id'; - - static const String author = 'author'; - - static const String partnerAuthor = 'partner_author'; - - static const String name = 'name'; - - static const String createdAt = 'created_at'; - - static const String updatedAt = 'updated_at'; -} diff --git a/angel_orm_generator/test/models/car.dart b/angel_orm_generator/test/models/car.dart index 3cf1a7b8..07521d09 100644 --- a/angel_orm_generator/test/models/car.dart +++ b/angel_orm_generator/test/models/car.dart @@ -4,7 +4,6 @@ import 'package:angel_model/angel_model.dart'; import 'package:angel_orm/angel_orm.dart'; import 'package:angel_serialize/angel_serialize.dart'; part 'car.g.dart'; -part 'car.serializer.g.dart'; @serializable @orm diff --git a/angel_orm_generator/test/models/car.g.dart b/angel_orm_generator/test/models/car.g.dart index cf25024e..b6bdba3f 100644 --- a/angel_orm_generator/test/models/car.g.dart +++ b/angel_orm_generator/test/models/car.g.dart @@ -221,3 +221,73 @@ class Car extends _Car { return CarSerializer.toMap(this); } } + +// ************************************************************************** +// SerializerGenerator +// ************************************************************************** + +abstract class CarSerializer { + static Car fromMap(Map map) { + return new Car( + id: map['id'] as String, + make: map['make'] as String, + description: map['description'] as String, + familyFriendly: map['family_friendly'] as bool, + recalledAt: map['recalled_at'] != null + ? (map['recalled_at'] is DateTime + ? (map['recalled_at'] as DateTime) + : DateTime.parse(map['recalled_at'].toString())) + : null, + createdAt: map['created_at'] != null + ? (map['created_at'] is DateTime + ? (map['created_at'] as DateTime) + : DateTime.parse(map['created_at'].toString())) + : null, + updatedAt: map['updated_at'] != null + ? (map['updated_at'] is DateTime + ? (map['updated_at'] as DateTime) + : DateTime.parse(map['updated_at'].toString())) + : null); + } + + static Map toMap(Car model) { + if (model == null) { + return null; + } + return { + 'id': model.id, + 'make': model.make, + 'description': model.description, + 'family_friendly': model.familyFriendly, + 'recalled_at': model.recalledAt?.toIso8601String(), + 'created_at': model.createdAt?.toIso8601String(), + 'updated_at': model.updatedAt?.toIso8601String() + }; + } +} + +abstract class CarFields { + static const List allFields = const [ + id, + make, + description, + familyFriendly, + recalledAt, + createdAt, + updatedAt + ]; + + static const String id = 'id'; + + static const String make = 'make'; + + static const String description = 'description'; + + static const String familyFriendly = 'family_friendly'; + + static const String recalledAt = 'recalled_at'; + + static const String createdAt = 'created_at'; + + static const String updatedAt = 'updated_at'; +} diff --git a/angel_orm_generator/test/models/car.serializer.g.dart b/angel_orm_generator/test/models/car.serializer.g.dart deleted file mode 100644 index 6ed45642..00000000 --- a/angel_orm_generator/test/models/car.serializer.g.dart +++ /dev/null @@ -1,73 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of angel_orm.generator.models.car; - -// ************************************************************************** -// SerializerGenerator -// ************************************************************************** - -abstract class CarSerializer { - static Car fromMap(Map map) { - return new Car( - id: map['id'] as String, - make: map['make'] as String, - description: map['description'] as String, - familyFriendly: map['family_friendly'] as bool, - recalledAt: map['recalled_at'] != null - ? (map['recalled_at'] is DateTime - ? (map['recalled_at'] as DateTime) - : DateTime.parse(map['recalled_at'].toString())) - : null, - createdAt: map['created_at'] != null - ? (map['created_at'] is DateTime - ? (map['created_at'] as DateTime) - : DateTime.parse(map['created_at'].toString())) - : null, - updatedAt: map['updated_at'] != null - ? (map['updated_at'] is DateTime - ? (map['updated_at'] as DateTime) - : DateTime.parse(map['updated_at'].toString())) - : null); - } - - static Map toMap(Car model) { - if (model == null) { - return null; - } - return { - 'id': model.id, - 'make': model.make, - 'description': model.description, - 'family_friendly': model.familyFriendly, - 'recalled_at': model.recalledAt?.toIso8601String(), - 'created_at': model.createdAt?.toIso8601String(), - 'updated_at': model.updatedAt?.toIso8601String() - }; - } -} - -abstract class CarFields { - static const List allFields = const [ - id, - make, - description, - familyFriendly, - recalledAt, - createdAt, - updatedAt - ]; - - static const String id = 'id'; - - static const String make = 'make'; - - static const String description = 'description'; - - static const String familyFriendly = 'family_friendly'; - - static const String recalledAt = 'recalled_at'; - - static const String createdAt = 'created_at'; - - static const String updatedAt = 'updated_at'; -} diff --git a/angel_orm_generator/test/models/customer.dart b/angel_orm_generator/test/models/customer.dart index 1852b590..12c25b26 100644 --- a/angel_orm_generator/test/models/customer.dart +++ b/angel_orm_generator/test/models/customer.dart @@ -4,7 +4,6 @@ import 'package:angel_model/angel_model.dart'; import 'package:angel_orm/angel_orm.dart'; import 'package:angel_serialize/angel_serialize.dart'; part 'customer.g.dart'; -part 'customer.serializer.g.dart'; @orm @serializable diff --git a/angel_orm_generator/test/models/customer.g.dart b/angel_orm_generator/test/models/customer.g.dart index c12fe984..7c52863e 100644 --- a/angel_orm_generator/test/models/customer.g.dart +++ b/angel_orm_generator/test/models/customer.g.dart @@ -121,3 +121,49 @@ class Customer extends _Customer { return CustomerSerializer.toMap(this); } } + +// ************************************************************************** +// SerializerGenerator +// ************************************************************************** + +abstract class CustomerSerializer { + static Customer fromMap(Map map) { + return new Customer( + id: map['id'] as String, + createdAt: map['created_at'] != null + ? (map['created_at'] is DateTime + ? (map['created_at'] as DateTime) + : DateTime.parse(map['created_at'].toString())) + : null, + updatedAt: map['updated_at'] != null + ? (map['updated_at'] is DateTime + ? (map['updated_at'] as DateTime) + : DateTime.parse(map['updated_at'].toString())) + : null); + } + + static Map toMap(Customer model) { + if (model == null) { + return null; + } + return { + 'id': model.id, + 'created_at': model.createdAt?.toIso8601String(), + 'updated_at': model.updatedAt?.toIso8601String() + }; + } +} + +abstract class CustomerFields { + static const List allFields = const [ + id, + createdAt, + updatedAt + ]; + + static const String id = 'id'; + + static const String createdAt = 'created_at'; + + static const String updatedAt = 'updated_at'; +} diff --git a/angel_orm_generator/test/models/customer.serializer.g.dart b/angel_orm_generator/test/models/customer.serializer.g.dart deleted file mode 100644 index 7a7a9fab..00000000 --- a/angel_orm_generator/test/models/customer.serializer.g.dart +++ /dev/null @@ -1,49 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of angel_orm_generator.test.models.customer; - -// ************************************************************************** -// SerializerGenerator -// ************************************************************************** - -abstract class CustomerSerializer { - static Customer fromMap(Map map) { - return new Customer( - id: map['id'] as String, - createdAt: map['created_at'] != null - ? (map['created_at'] is DateTime - ? (map['created_at'] as DateTime) - : DateTime.parse(map['created_at'].toString())) - : null, - updatedAt: map['updated_at'] != null - ? (map['updated_at'] is DateTime - ? (map['updated_at'] as DateTime) - : DateTime.parse(map['updated_at'].toString())) - : null); - } - - static Map toMap(Customer model) { - if (model == null) { - return null; - } - return { - 'id': model.id, - 'created_at': model.createdAt?.toIso8601String(), - 'updated_at': model.updatedAt?.toIso8601String() - }; - } -} - -abstract class CustomerFields { - static const List allFields = const [ - id, - createdAt, - updatedAt - ]; - - static const String id = 'id'; - - static const String createdAt = 'created_at'; - - static const String updatedAt = 'updated_at'; -} diff --git a/angel_orm_generator/test/models/foot.dart b/angel_orm_generator/test/models/foot.dart index 0fd189ce..d6234cba 100644 --- a/angel_orm_generator/test/models/foot.dart +++ b/angel_orm_generator/test/models/foot.dart @@ -4,7 +4,6 @@ import 'package:angel_model/angel_model.dart'; import 'package:angel_orm/angel_orm.dart'; import 'package:angel_serialize/angel_serialize.dart'; part 'foot.g.dart'; -part 'foot.serializer.g.dart'; @serializable @Orm(tableName: 'feet') diff --git a/angel_orm_generator/test/models/foot.g.dart b/angel_orm_generator/test/models/foot.g.dart index f7936160..c7d43562 100644 --- a/angel_orm_generator/test/models/foot.g.dart +++ b/angel_orm_generator/test/models/foot.g.dart @@ -158,3 +158,59 @@ class Foot extends _Foot { return FootSerializer.toMap(this); } } + +// ************************************************************************** +// SerializerGenerator +// ************************************************************************** + +abstract class FootSerializer { + static Foot fromMap(Map map) { + return new Foot( + id: map['id'] as String, + legId: map['leg_id'] as int, + nToes: map['n_toes'] as int, + createdAt: map['created_at'] != null + ? (map['created_at'] is DateTime + ? (map['created_at'] as DateTime) + : DateTime.parse(map['created_at'].toString())) + : null, + updatedAt: map['updated_at'] != null + ? (map['updated_at'] is DateTime + ? (map['updated_at'] as DateTime) + : DateTime.parse(map['updated_at'].toString())) + : null); + } + + static Map toMap(Foot model) { + if (model == null) { + return null; + } + return { + 'id': model.id, + 'leg_id': model.legId, + 'n_toes': model.nToes, + 'created_at': model.createdAt?.toIso8601String(), + 'updated_at': model.updatedAt?.toIso8601String() + }; + } +} + +abstract class FootFields { + static const List allFields = const [ + id, + legId, + nToes, + createdAt, + updatedAt + ]; + + static const String id = 'id'; + + static const String legId = 'leg_id'; + + static const String nToes = 'n_toes'; + + static const String createdAt = 'created_at'; + + static const String updatedAt = 'updated_at'; +} diff --git a/angel_orm_generator/test/models/foot.serializer.g.dart b/angel_orm_generator/test/models/foot.serializer.g.dart deleted file mode 100644 index 6e273e62..00000000 --- a/angel_orm_generator/test/models/foot.serializer.g.dart +++ /dev/null @@ -1,59 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of angel_orm_generator.test.models.foot; - -// ************************************************************************** -// SerializerGenerator -// ************************************************************************** - -abstract class FootSerializer { - static Foot fromMap(Map map) { - return new Foot( - id: map['id'] as String, - legId: map['leg_id'] as int, - nToes: map['n_toes'] as int, - createdAt: map['created_at'] != null - ? (map['created_at'] is DateTime - ? (map['created_at'] as DateTime) - : DateTime.parse(map['created_at'].toString())) - : null, - updatedAt: map['updated_at'] != null - ? (map['updated_at'] is DateTime - ? (map['updated_at'] as DateTime) - : DateTime.parse(map['updated_at'].toString())) - : null); - } - - static Map toMap(Foot model) { - if (model == null) { - return null; - } - return { - 'id': model.id, - 'leg_id': model.legId, - 'n_toes': model.nToes, - 'created_at': model.createdAt?.toIso8601String(), - 'updated_at': model.updatedAt?.toIso8601String() - }; - } -} - -abstract class FootFields { - static const List allFields = const [ - id, - legId, - nToes, - createdAt, - updatedAt - ]; - - static const String id = 'id'; - - static const String legId = 'leg_id'; - - static const String nToes = 'n_toes'; - - static const String createdAt = 'created_at'; - - static const String updatedAt = 'updated_at'; -} diff --git a/angel_orm_generator/test/models/fruit.dart b/angel_orm_generator/test/models/fruit.dart index 1bd9bce5..d7417b08 100644 --- a/angel_orm_generator/test/models/fruit.dart +++ b/angel_orm_generator/test/models/fruit.dart @@ -4,7 +4,6 @@ import 'package:angel_model/angel_model.dart'; import 'package:angel_orm/angel_orm.dart'; import 'package:angel_serialize/angel_serialize.dart'; part 'fruit.g.dart'; -part 'fruit.serializer.g.dart'; @serializable @orm diff --git a/angel_orm_generator/test/models/fruit.g.dart b/angel_orm_generator/test/models/fruit.g.dart index 6ebdbfb3..148c78aa 100644 --- a/angel_orm_generator/test/models/fruit.g.dart +++ b/angel_orm_generator/test/models/fruit.g.dart @@ -159,3 +159,59 @@ class Fruit extends _Fruit { return FruitSerializer.toMap(this); } } + +// ************************************************************************** +// SerializerGenerator +// ************************************************************************** + +abstract class FruitSerializer { + static Fruit fromMap(Map map) { + return new Fruit( + id: map['id'] as String, + treeId: map['tree_id'] as int, + commonName: map['common_name'] as String, + createdAt: map['created_at'] != null + ? (map['created_at'] is DateTime + ? (map['created_at'] as DateTime) + : DateTime.parse(map['created_at'].toString())) + : null, + updatedAt: map['updated_at'] != null + ? (map['updated_at'] is DateTime + ? (map['updated_at'] as DateTime) + : DateTime.parse(map['updated_at'].toString())) + : null); + } + + static Map toMap(Fruit model) { + if (model == null) { + return null; + } + return { + 'id': model.id, + 'tree_id': model.treeId, + 'common_name': model.commonName, + 'created_at': model.createdAt?.toIso8601String(), + 'updated_at': model.updatedAt?.toIso8601String() + }; + } +} + +abstract class FruitFields { + static const List allFields = const [ + id, + treeId, + commonName, + createdAt, + updatedAt + ]; + + static const String id = 'id'; + + static const String treeId = 'tree_id'; + + static const String commonName = 'common_name'; + + static const String createdAt = 'created_at'; + + static const String updatedAt = 'updated_at'; +} diff --git a/angel_orm_generator/test/models/fruit.serializer.g.dart b/angel_orm_generator/test/models/fruit.serializer.g.dart deleted file mode 100644 index 264d6635..00000000 --- a/angel_orm_generator/test/models/fruit.serializer.g.dart +++ /dev/null @@ -1,59 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of angel_orm_generator.test.models.fruit; - -// ************************************************************************** -// SerializerGenerator -// ************************************************************************** - -abstract class FruitSerializer { - static Fruit fromMap(Map map) { - return new Fruit( - id: map['id'] as String, - treeId: map['tree_id'] as int, - commonName: map['common_name'] as String, - createdAt: map['created_at'] != null - ? (map['created_at'] is DateTime - ? (map['created_at'] as DateTime) - : DateTime.parse(map['created_at'].toString())) - : null, - updatedAt: map['updated_at'] != null - ? (map['updated_at'] is DateTime - ? (map['updated_at'] as DateTime) - : DateTime.parse(map['updated_at'].toString())) - : null); - } - - static Map toMap(Fruit model) { - if (model == null) { - return null; - } - return { - 'id': model.id, - 'tree_id': model.treeId, - 'common_name': model.commonName, - 'created_at': model.createdAt?.toIso8601String(), - 'updated_at': model.updatedAt?.toIso8601String() - }; - } -} - -abstract class FruitFields { - static const List allFields = const [ - id, - treeId, - commonName, - createdAt, - updatedAt - ]; - - static const String id = 'id'; - - static const String treeId = 'tree_id'; - - static const String commonName = 'common_name'; - - static const String createdAt = 'created_at'; - - static const String updatedAt = 'updated_at'; -} diff --git a/angel_orm_generator/test/models/leg.dart b/angel_orm_generator/test/models/leg.dart index 7b86ae32..40ff716e 100644 --- a/angel_orm_generator/test/models/leg.dart +++ b/angel_orm_generator/test/models/leg.dart @@ -5,7 +5,6 @@ import 'package:angel_orm/angel_orm.dart'; import 'package:angel_serialize/angel_serialize.dart'; import 'foot.dart'; part 'leg.g.dart'; -part 'leg.serializer.g.dart'; @serializable @orm diff --git a/angel_orm_generator/test/models/leg.g.dart b/angel_orm_generator/test/models/leg.g.dart index 1f9420f7..fa0dfea8 100644 --- a/angel_orm_generator/test/models/leg.g.dart +++ b/angel_orm_generator/test/models/leg.g.dart @@ -170,3 +170,61 @@ class Leg extends _Leg { return LegSerializer.toMap(this); } } + +// ************************************************************************** +// SerializerGenerator +// ************************************************************************** + +abstract class LegSerializer { + static Leg fromMap(Map map) { + return new Leg( + id: map['id'] as String, + foot: map['foot'] != null + ? FootSerializer.fromMap(map['foot'] as Map) + : null, + name: map['name'] as String, + createdAt: map['created_at'] != null + ? (map['created_at'] is DateTime + ? (map['created_at'] as DateTime) + : DateTime.parse(map['created_at'].toString())) + : null, + updatedAt: map['updated_at'] != null + ? (map['updated_at'] is DateTime + ? (map['updated_at'] as DateTime) + : DateTime.parse(map['updated_at'].toString())) + : null); + } + + static Map toMap(Leg model) { + if (model == null) { + return null; + } + return { + 'id': model.id, + 'foot': FootSerializer.toMap(model.foot), + 'name': model.name, + 'created_at': model.createdAt?.toIso8601String(), + 'updated_at': model.updatedAt?.toIso8601String() + }; + } +} + +abstract class LegFields { + static const List allFields = const [ + id, + foot, + name, + createdAt, + updatedAt + ]; + + static const String id = 'id'; + + static const String foot = 'foot'; + + static const String name = 'name'; + + static const String createdAt = 'created_at'; + + static const String updatedAt = 'updated_at'; +} diff --git a/angel_orm_generator/test/models/leg.serializer.g.dart b/angel_orm_generator/test/models/leg.serializer.g.dart deleted file mode 100644 index 2707e671..00000000 --- a/angel_orm_generator/test/models/leg.serializer.g.dart +++ /dev/null @@ -1,61 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of angel_orm_generator.test.models.leg; - -// ************************************************************************** -// SerializerGenerator -// ************************************************************************** - -abstract class LegSerializer { - static Leg fromMap(Map map) { - return new Leg( - id: map['id'] as String, - foot: map['foot'] != null - ? FootSerializer.fromMap(map['foot'] as Map) - : null, - name: map['name'] as String, - createdAt: map['created_at'] != null - ? (map['created_at'] is DateTime - ? (map['created_at'] as DateTime) - : DateTime.parse(map['created_at'].toString())) - : null, - updatedAt: map['updated_at'] != null - ? (map['updated_at'] is DateTime - ? (map['updated_at'] as DateTime) - : DateTime.parse(map['updated_at'].toString())) - : null); - } - - static Map toMap(Leg model) { - if (model == null) { - return null; - } - return { - 'id': model.id, - 'foot': FootSerializer.toMap(model.foot), - 'name': model.name, - 'created_at': model.createdAt?.toIso8601String(), - 'updated_at': model.updatedAt?.toIso8601String() - }; - } -} - -abstract class LegFields { - static const List allFields = const [ - id, - foot, - name, - createdAt, - updatedAt - ]; - - static const String id = 'id'; - - static const String foot = 'foot'; - - static const String name = 'name'; - - static const String createdAt = 'created_at'; - - static const String updatedAt = 'updated_at'; -} diff --git a/angel_orm_generator/test/models/order.dart b/angel_orm_generator/test/models/order.dart index b59c6fca..2cc012dc 100644 --- a/angel_orm_generator/test/models/order.dart +++ b/angel_orm_generator/test/models/order.dart @@ -5,7 +5,6 @@ import 'package:angel_orm/angel_orm.dart'; import 'package:angel_serialize/angel_serialize.dart'; import 'customer.dart'; part 'order.g.dart'; -part 'order.serializer.g.dart'; @orm @serializable diff --git a/angel_orm_generator/test/models/order.g.dart b/angel_orm_generator/test/models/order.g.dart index b959e436..75b5e5c6 100644 --- a/angel_orm_generator/test/models/order.g.dart +++ b/angel_orm_generator/test/models/order.g.dart @@ -221,3 +221,73 @@ class Order extends _Order { return OrderSerializer.toMap(this); } } + +// ************************************************************************** +// SerializerGenerator +// ************************************************************************** + +abstract class OrderSerializer { + static Order fromMap(Map map) { + return new Order( + id: map['id'] as String, + customerId: map['customer_id'] as int, + employeeId: map['employee_id'] as int, + orderDate: map['order_date'] != null + ? (map['order_date'] is DateTime + ? (map['order_date'] as DateTime) + : DateTime.parse(map['order_date'].toString())) + : null, + shipperId: map['shipper_id'] as int, + createdAt: map['created_at'] != null + ? (map['created_at'] is DateTime + ? (map['created_at'] as DateTime) + : DateTime.parse(map['created_at'].toString())) + : null, + updatedAt: map['updated_at'] != null + ? (map['updated_at'] is DateTime + ? (map['updated_at'] as DateTime) + : DateTime.parse(map['updated_at'].toString())) + : null); + } + + static Map toMap(Order model) { + if (model == null) { + return null; + } + return { + 'id': model.id, + 'customer_id': model.customerId, + 'employee_id': model.employeeId, + 'order_date': model.orderDate?.toIso8601String(), + 'shipper_id': model.shipperId, + 'created_at': model.createdAt?.toIso8601String(), + 'updated_at': model.updatedAt?.toIso8601String() + }; + } +} + +abstract class OrderFields { + static const List allFields = const [ + id, + customerId, + employeeId, + orderDate, + shipperId, + createdAt, + updatedAt + ]; + + static const String id = 'id'; + + static const String customerId = 'customer_id'; + + static const String employeeId = 'employee_id'; + + static const String orderDate = 'order_date'; + + static const String shipperId = 'shipper_id'; + + static const String createdAt = 'created_at'; + + static const String updatedAt = 'updated_at'; +} diff --git a/angel_orm_generator/test/models/order.serializer.g.dart b/angel_orm_generator/test/models/order.serializer.g.dart deleted file mode 100644 index 03e4a5b8..00000000 --- a/angel_orm_generator/test/models/order.serializer.g.dart +++ /dev/null @@ -1,73 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of angel_orm_generator.test.models.order; - -// ************************************************************************** -// SerializerGenerator -// ************************************************************************** - -abstract class OrderSerializer { - static Order fromMap(Map map) { - return new Order( - id: map['id'] as String, - customerId: map['customer_id'] as int, - employeeId: map['employee_id'] as int, - orderDate: map['order_date'] != null - ? (map['order_date'] is DateTime - ? (map['order_date'] as DateTime) - : DateTime.parse(map['order_date'].toString())) - : null, - shipperId: map['shipper_id'] as int, - createdAt: map['created_at'] != null - ? (map['created_at'] is DateTime - ? (map['created_at'] as DateTime) - : DateTime.parse(map['created_at'].toString())) - : null, - updatedAt: map['updated_at'] != null - ? (map['updated_at'] is DateTime - ? (map['updated_at'] as DateTime) - : DateTime.parse(map['updated_at'].toString())) - : null); - } - - static Map toMap(Order model) { - if (model == null) { - return null; - } - return { - 'id': model.id, - 'customer_id': model.customerId, - 'employee_id': model.employeeId, - 'order_date': model.orderDate?.toIso8601String(), - 'shipper_id': model.shipperId, - 'created_at': model.createdAt?.toIso8601String(), - 'updated_at': model.updatedAt?.toIso8601String() - }; - } -} - -abstract class OrderFields { - static const List allFields = const [ - id, - customerId, - employeeId, - orderDate, - shipperId, - createdAt, - updatedAt - ]; - - static const String id = 'id'; - - static const String customerId = 'customer_id'; - - static const String employeeId = 'employee_id'; - - static const String orderDate = 'order_date'; - - static const String shipperId = 'shipper_id'; - - static const String createdAt = 'created_at'; - - static const String updatedAt = 'updated_at'; -} diff --git a/angel_orm_generator/test/models/role.dart b/angel_orm_generator/test/models/role.dart index b68d32f6..b2177b4e 100644 --- a/angel_orm_generator/test/models/role.dart +++ b/angel_orm_generator/test/models/role.dart @@ -4,8 +4,6 @@ import 'package:angel_model/angel_model.dart'; import 'package:angel_orm/angel_orm.dart'; import 'package:angel_serialize/angel_serialize.dart'; part 'role.g.dart'; -part 'role.serializer.g.dart'; - @serializable @orm class _Role extends Model { diff --git a/angel_orm_generator/test/models/role.g.dart b/angel_orm_generator/test/models/role.g.dart index 645f1558..a5626cb3 100644 --- a/angel_orm_generator/test/models/role.g.dart +++ b/angel_orm_generator/test/models/role.g.dart @@ -139,3 +139,54 @@ class Role extends _Role { return RoleSerializer.toMap(this); } } + +// ************************************************************************** +// SerializerGenerator +// ************************************************************************** + +abstract class RoleSerializer { + static Role fromMap(Map map) { + return new Role( + id: map['id'] as String, + name: map['name'] as String, + createdAt: map['created_at'] != null + ? (map['created_at'] is DateTime + ? (map['created_at'] as DateTime) + : DateTime.parse(map['created_at'].toString())) + : null, + updatedAt: map['updated_at'] != null + ? (map['updated_at'] is DateTime + ? (map['updated_at'] as DateTime) + : DateTime.parse(map['updated_at'].toString())) + : null); + } + + static Map toMap(Role model) { + if (model == null) { + return null; + } + return { + 'id': model.id, + 'name': model.name, + 'created_at': model.createdAt?.toIso8601String(), + 'updated_at': model.updatedAt?.toIso8601String() + }; + } +} + +abstract class RoleFields { + static const List allFields = const [ + id, + name, + createdAt, + updatedAt + ]; + + static const String id = 'id'; + + static const String name = 'name'; + + static const String createdAt = 'created_at'; + + static const String updatedAt = 'updated_at'; +} diff --git a/angel_orm_generator/test/models/role.serializer.g.dart b/angel_orm_generator/test/models/role.serializer.g.dart deleted file mode 100644 index 60aeda1a..00000000 --- a/angel_orm_generator/test/models/role.serializer.g.dart +++ /dev/null @@ -1,54 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of angel_orm_generator.test.models.role; - -// ************************************************************************** -// SerializerGenerator -// ************************************************************************** - -abstract class RoleSerializer { - static Role fromMap(Map map) { - return new Role( - id: map['id'] as String, - name: map['name'] as String, - createdAt: map['created_at'] != null - ? (map['created_at'] is DateTime - ? (map['created_at'] as DateTime) - : DateTime.parse(map['created_at'].toString())) - : null, - updatedAt: map['updated_at'] != null - ? (map['updated_at'] is DateTime - ? (map['updated_at'] as DateTime) - : DateTime.parse(map['updated_at'].toString())) - : null); - } - - static Map toMap(Role model) { - if (model == null) { - return null; - } - return { - 'id': model.id, - 'name': model.name, - 'created_at': model.createdAt?.toIso8601String(), - 'updated_at': model.updatedAt?.toIso8601String() - }; - } -} - -abstract class RoleFields { - static const List allFields = const [ - id, - name, - createdAt, - updatedAt - ]; - - static const String id = 'id'; - - static const String name = 'name'; - - static const String createdAt = 'created_at'; - - static const String updatedAt = 'updated_at'; -} diff --git a/angel_orm_generator/test/models/tree.dart b/angel_orm_generator/test/models/tree.dart index d5e38780..dcaa1c58 100644 --- a/angel_orm_generator/test/models/tree.dart +++ b/angel_orm_generator/test/models/tree.dart @@ -6,7 +6,6 @@ import 'package:angel_serialize/angel_serialize.dart'; import 'package:collection/collection.dart'; import 'fruit.dart'; part 'tree.g.dart'; -part 'tree.serializer.g.dart'; @serializable @orm diff --git a/angel_orm_generator/test/models/tree.g.dart b/angel_orm_generator/test/models/tree.g.dart index 413a92b1..a18b4ba1 100644 --- a/angel_orm_generator/test/models/tree.g.dart +++ b/angel_orm_generator/test/models/tree.g.dart @@ -195,3 +195,63 @@ class Tree extends _Tree { return TreeSerializer.toMap(this); } } + +// ************************************************************************** +// SerializerGenerator +// ************************************************************************** + +abstract class TreeSerializer { + static Tree fromMap(Map map) { + return new Tree( + id: map['id'] as String, + rings: map['rings'] as int, + fruits: map['fruits'] is Iterable + ? new List.unmodifiable(((map['fruits'] as Iterable) + .where((x) => x is Map) as Iterable) + .map(FruitSerializer.fromMap)) + : null, + createdAt: map['created_at'] != null + ? (map['created_at'] is DateTime + ? (map['created_at'] as DateTime) + : DateTime.parse(map['created_at'].toString())) + : null, + updatedAt: map['updated_at'] != null + ? (map['updated_at'] is DateTime + ? (map['updated_at'] as DateTime) + : DateTime.parse(map['updated_at'].toString())) + : null); + } + + static Map toMap(Tree model) { + if (model == null) { + return null; + } + return { + 'id': model.id, + 'rings': model.rings, + 'fruits': model.fruits?.map((m) => m.toJson())?.toList(), + 'created_at': model.createdAt?.toIso8601String(), + 'updated_at': model.updatedAt?.toIso8601String() + }; + } +} + +abstract class TreeFields { + static const List allFields = const [ + id, + rings, + fruits, + createdAt, + updatedAt + ]; + + static const String id = 'id'; + + static const String rings = 'rings'; + + static const String fruits = 'fruits'; + + static const String createdAt = 'created_at'; + + static const String updatedAt = 'updated_at'; +} diff --git a/angel_orm_generator/test/models/tree.serializer.g.dart b/angel_orm_generator/test/models/tree.serializer.g.dart deleted file mode 100644 index 90211f04..00000000 --- a/angel_orm_generator/test/models/tree.serializer.g.dart +++ /dev/null @@ -1,63 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of angel_orm_generator.test.models.tree; - -// ************************************************************************** -// SerializerGenerator -// ************************************************************************** - -abstract class TreeSerializer { - static Tree fromMap(Map map) { - return new Tree( - id: map['id'] as String, - rings: map['rings'] as int, - fruits: map['fruits'] is Iterable - ? new List.unmodifiable(((map['fruits'] as Iterable) - .where((x) => x is Map) as Iterable) - .map(FruitSerializer.fromMap)) - : null, - createdAt: map['created_at'] != null - ? (map['created_at'] is DateTime - ? (map['created_at'] as DateTime) - : DateTime.parse(map['created_at'].toString())) - : null, - updatedAt: map['updated_at'] != null - ? (map['updated_at'] is DateTime - ? (map['updated_at'] as DateTime) - : DateTime.parse(map['updated_at'].toString())) - : null); - } - - static Map toMap(Tree model) { - if (model == null) { - return null; - } - return { - 'id': model.id, - 'rings': model.rings, - 'fruits': model.fruits?.map((m) => m.toJson())?.toList(), - 'created_at': model.createdAt?.toIso8601String(), - 'updated_at': model.updatedAt?.toIso8601String() - }; - } -} - -abstract class TreeFields { - static const List allFields = const [ - id, - rings, - fruits, - createdAt, - updatedAt - ]; - - static const String id = 'id'; - - static const String rings = 'rings'; - - static const String fruits = 'fruits'; - - static const String createdAt = 'created_at'; - - static const String updatedAt = 'updated_at'; -} diff --git a/angel_orm_generator/test/models/user.dart b/angel_orm_generator/test/models/user.dart index 7d6cf104..260b5010 100644 --- a/angel_orm_generator/test/models/user.dart +++ b/angel_orm_generator/test/models/user.dart @@ -6,7 +6,6 @@ import 'package:angel_serialize/angel_serialize.dart'; import 'package:collection/collection.dart'; import 'role.dart'; part 'user.g.dart'; -part 'user.serializer.g.dart'; @serializable @orm diff --git a/angel_orm_generator/test/models/user.g.dart b/angel_orm_generator/test/models/user.g.dart index cb238f93..b5e775d2 100644 --- a/angel_orm_generator/test/models/user.g.dart +++ b/angel_orm_generator/test/models/user.g.dart @@ -187,3 +187,64 @@ class User extends _User { return UserSerializer.toMap(this); } } + +// ************************************************************************** +// SerializerGenerator +// ************************************************************************** + +abstract class UserSerializer { + static User fromMap(Map map) { + return new User( + id: map['id'] as String, + username: map['username'] as String, + password: map['password'] as String, + email: map['email'] as String, + createdAt: map['created_at'] != null + ? (map['created_at'] is DateTime + ? (map['created_at'] as DateTime) + : DateTime.parse(map['created_at'].toString())) + : null, + updatedAt: map['updated_at'] != null + ? (map['updated_at'] is DateTime + ? (map['updated_at'] as DateTime) + : DateTime.parse(map['updated_at'].toString())) + : null); + } + + static Map toMap(User model) { + if (model == null) { + return null; + } + return { + 'id': model.id, + 'username': model.username, + 'password': model.password, + 'email': model.email, + 'created_at': model.createdAt?.toIso8601String(), + 'updated_at': model.updatedAt?.toIso8601String() + }; + } +} + +abstract class UserFields { + static const List allFields = const [ + id, + username, + password, + email, + createdAt, + updatedAt + ]; + + static const String id = 'id'; + + static const String username = 'username'; + + static const String password = 'password'; + + static const String email = 'email'; + + static const String createdAt = 'created_at'; + + static const String updatedAt = 'updated_at'; +} diff --git a/angel_orm_generator/test/models/user.serializer.g.dart b/angel_orm_generator/test/models/user.serializer.g.dart deleted file mode 100644 index 69cc37a0..00000000 --- a/angel_orm_generator/test/models/user.serializer.g.dart +++ /dev/null @@ -1,64 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of angel_orm_generator.test.models.user; - -// ************************************************************************** -// SerializerGenerator -// ************************************************************************** - -abstract class UserSerializer { - static User fromMap(Map map) { - return new User( - id: map['id'] as String, - username: map['username'] as String, - password: map['password'] as String, - email: map['email'] as String, - createdAt: map['created_at'] != null - ? (map['created_at'] is DateTime - ? (map['created_at'] as DateTime) - : DateTime.parse(map['created_at'].toString())) - : null, - updatedAt: map['updated_at'] != null - ? (map['updated_at'] is DateTime - ? (map['updated_at'] as DateTime) - : DateTime.parse(map['updated_at'].toString())) - : null); - } - - static Map toMap(User model) { - if (model == null) { - return null; - } - return { - 'id': model.id, - 'username': model.username, - 'password': model.password, - 'email': model.email, - 'created_at': model.createdAt?.toIso8601String(), - 'updated_at': model.updatedAt?.toIso8601String() - }; - } -} - -abstract class UserFields { - static const List allFields = const [ - id, - username, - password, - email, - createdAt, - updatedAt - ]; - - static const String id = 'id'; - - static const String username = 'username'; - - static const String password = 'password'; - - static const String email = 'email'; - - static const String createdAt = 'created_at'; - - static const String updatedAt = 'updated_at'; -}