From 174388e0753930eb8173ffeea5f8e42d7d74b539 Mon Sep 17 00:00:00 2001 From: thomashii Date: Sun, 27 Feb 2022 12:30:22 +0800 Subject: [PATCH] Updated ORM --- packages/orm/angel_orm_generator/example/main.g.dart | 4 ++-- .../orm/angel_orm_test/lib/src/models/book.g.dart | 4 ++-- .../orm/angel_orm_test/lib/src/models/car.g.dart | 2 +- .../angel_orm_test/lib/src/models/custom_expr.g.dart | 4 ++-- .../lib/src/models/email_indexed.g.dart | 6 +++--- .../orm/angel_orm_test/lib/src/models/fortune.g.dart | 2 +- .../orm/angel_orm_test/lib/src/models/has_car.g.dart | 4 ++-- .../orm/angel_orm_test/lib/src/models/has_map.g.dart | 2 +- .../orm/angel_orm_test/lib/src/models/leg.g.dart | 4 ++-- .../orm/angel_orm_test/lib/src/models/order.g.dart | 4 ++-- .../orm/angel_orm_test/lib/src/models/person.g.dart | 4 ++-- .../lib/src/models/person_order.g.dart | 4 ++-- .../orm/angel_orm_test/lib/src/models/tree.g.dart | 4 ++-- .../angel_orm_test/lib/src/models/unorthodox.g.dart | 12 ++++++------ .../orm/angel_orm_test/lib/src/models/user.g.dart | 6 +++--- .../orm/angel_orm_test/lib/src/models/world.g.dart | 2 +- 16 files changed, 34 insertions(+), 34 deletions(-) diff --git a/packages/orm/angel_orm_generator/example/main.g.dart b/packages/orm/angel_orm_generator/example/main.g.dart index e308677b..97d1d0db 100644 --- a/packages/orm/angel_orm_generator/example/main.g.dart +++ b/packages/orm/angel_orm_generator/example/main.g.dart @@ -48,7 +48,7 @@ class EmployeeQuery extends Query { @override Map get casts { - return {'salary': 'text'}; + return {'salary': 'char'}; } @override @@ -324,7 +324,7 @@ class EmployeeSerializer extends Codec { static Map toMap(_Employee? model) { if (model == null) { - return {}; + throw FormatException("Required field [model] cannot be null"); } return { 'id': model.id, diff --git a/packages/orm/angel_orm_test/lib/src/models/book.g.dart b/packages/orm/angel_orm_test/lib/src/models/book.g.dart index 417b84af..e7342120 100644 --- a/packages/orm/angel_orm_test/lib/src/models/book.g.dart +++ b/packages/orm/angel_orm_test/lib/src/models/book.g.dart @@ -531,7 +531,7 @@ class BookSerializer extends Codec { static Map toMap(_Book? model) { if (model == null) { - return {}; + throw FormatException("Required field [model] cannot be null"); } return { 'id': model.id, @@ -608,7 +608,7 @@ class AuthorSerializer extends Codec { static Map toMap(_Author? model) { if (model == null) { - return {}; + throw FormatException("Required field [model] cannot be null"); } return { 'id': model.id, diff --git a/packages/orm/angel_orm_test/lib/src/models/car.g.dart b/packages/orm/angel_orm_test/lib/src/models/car.g.dart index e7329ddc..6c3c5c91 100644 --- a/packages/orm/angel_orm_test/lib/src/models/car.g.dart +++ b/packages/orm/angel_orm_test/lib/src/models/car.g.dart @@ -342,7 +342,7 @@ class CarSerializer extends Codec { static Map toMap(_Car? model) { if (model == null) { - return {}; + throw FormatException("Required field [model] cannot be null"); } return { 'id': model.id, diff --git a/packages/orm/angel_orm_test/lib/src/models/custom_expr.g.dart b/packages/orm/angel_orm_test/lib/src/models/custom_expr.g.dart index a5335c28..1993d623 100644 --- a/packages/orm/angel_orm_test/lib/src/models/custom_expr.g.dart +++ b/packages/orm/angel_orm_test/lib/src/models/custom_expr.g.dart @@ -467,7 +467,7 @@ class NumbersSerializer extends Codec { static Map toMap(_Numbers? model) { if (model == null) { - return {}; + throw FormatException("Required field [model] cannot be null"); } return { 'id': model.id, @@ -534,7 +534,7 @@ class AlphabetSerializer extends Codec { static Map toMap(_Alphabet? model) { if (model == null) { - return {}; + throw FormatException("Required field [model] cannot be null"); } return { 'id': model.id, diff --git a/packages/orm/angel_orm_test/lib/src/models/email_indexed.g.dart b/packages/orm/angel_orm_test/lib/src/models/email_indexed.g.dart index ea648f30..be558599 100644 --- a/packages/orm/angel_orm_test/lib/src/models/email_indexed.g.dart +++ b/packages/orm/angel_orm_test/lib/src/models/email_indexed.g.dart @@ -700,7 +700,7 @@ class RoleSerializer extends Codec { static Map toMap(_Role? model) { if (model == null) { - return {}; + throw FormatException("Required field [model] cannot be null"); } return { 'role': model.role, @@ -752,7 +752,7 @@ class RoleUserSerializer extends Codec { static Map toMap(_RoleUser? model) { if (model == null) { - return {}; + throw FormatException("Required field [model] cannot be null"); } return { 'role': RoleSerializer.toMap(model.role), @@ -805,7 +805,7 @@ class UserSerializer extends Codec { static Map toMap(_User? model) { if (model == null) { - return {}; + throw FormatException("Required field [model] cannot be null"); } return { 'email': model.email, diff --git a/packages/orm/angel_orm_test/lib/src/models/fortune.g.dart b/packages/orm/angel_orm_test/lib/src/models/fortune.g.dart index dff7bbb5..6e10b252 100644 --- a/packages/orm/angel_orm_test/lib/src/models/fortune.g.dart +++ b/packages/orm/angel_orm_test/lib/src/models/fortune.g.dart @@ -197,7 +197,7 @@ class FortuneSerializer extends Codec { static Map toMap(_Fortune? model) { if (model == null) { - return {}; + throw FormatException("Required field [model] cannot be null"); } return {'id': model.id, 'message': model.message}; } diff --git a/packages/orm/angel_orm_test/lib/src/models/has_car.g.dart b/packages/orm/angel_orm_test/lib/src/models/has_car.g.dart index 5c6e39ac..fde5d0f6 100644 --- a/packages/orm/angel_orm_test/lib/src/models/has_car.g.dart +++ b/packages/orm/angel_orm_test/lib/src/models/has_car.g.dart @@ -253,7 +253,7 @@ class HasCarSerializer extends Codec { : DateTime.parse(map['updated_at'].toString())) : null, type: map['type'] is CarType? - ? (map['type'] as CarType?) + ? (map['type'] as CarType?) ?? CarType.sedan : (map['type'] is int ? CarType?.values[map['type'] as int] : CarType.sedan)); @@ -261,7 +261,7 @@ class HasCarSerializer extends Codec { static Map toMap(_HasCar? model) { if (model == null) { - return {}; + throw FormatException("Required field [model] cannot be null"); } return { 'id': model.id, diff --git a/packages/orm/angel_orm_test/lib/src/models/has_map.g.dart b/packages/orm/angel_orm_test/lib/src/models/has_map.g.dart index 5ae1f6a5..470ec728 100644 --- a/packages/orm/angel_orm_test/lib/src/models/has_map.g.dart +++ b/packages/orm/angel_orm_test/lib/src/models/has_map.g.dart @@ -211,7 +211,7 @@ class HasMapSerializer extends Codec { static Map toMap(_HasMap? model) { if (model == null) { - return {}; + throw FormatException("Required field [model] cannot be null"); } return {'value': model.value, 'list': model.list}; } diff --git a/packages/orm/angel_orm_test/lib/src/models/leg.g.dart b/packages/orm/angel_orm_test/lib/src/models/leg.g.dart index 1110200f..5117f6b4 100644 --- a/packages/orm/angel_orm_test/lib/src/models/leg.g.dart +++ b/packages/orm/angel_orm_test/lib/src/models/leg.g.dart @@ -492,7 +492,7 @@ class LegSerializer extends Codec { static Map toMap(_Leg? model) { if (model == null) { - return {}; + throw FormatException("Required field [model] cannot be null"); } return { 'id': model.id, @@ -566,7 +566,7 @@ class FootSerializer extends Codec { static Map toMap(_Foot? model) { if (model == null) { - return {}; + throw FormatException("Required field [model] cannot be null"); } return { 'id': model.id, diff --git a/packages/orm/angel_orm_test/lib/src/models/order.g.dart b/packages/orm/angel_orm_test/lib/src/models/order.g.dart index 10c7b953..b5845d6b 100644 --- a/packages/orm/angel_orm_test/lib/src/models/order.g.dart +++ b/packages/orm/angel_orm_test/lib/src/models/order.g.dart @@ -526,7 +526,7 @@ class OrderSerializer extends Codec { static Map toMap(_Order? model) { if (model == null) { - return {}; + throw FormatException("Required field [model] cannot be null"); } return { 'id': model.id, @@ -606,7 +606,7 @@ class CustomerSerializer extends Codec { static Map toMap(_Customer? model) { if (model == null) { - return {}; + throw FormatException("Required field [model] cannot be null"); } return { 'id': model.id, diff --git a/packages/orm/angel_orm_test/lib/src/models/person.g.dart b/packages/orm/angel_orm_test/lib/src/models/person.g.dart index 151fe607..2f7ccd44 100644 --- a/packages/orm/angel_orm_test/lib/src/models/person.g.dart +++ b/packages/orm/angel_orm_test/lib/src/models/person.g.dart @@ -412,7 +412,7 @@ class PersonSerializer extends Codec { static Map toMap(_Person? model) { if (model == null) { - return {}; + throw FormatException("Required field [model] cannot be null"); } return { 'id': model.id, @@ -479,7 +479,7 @@ class PersonWithLastOrderSerializer extends Codec { static Map toMap(_PersonWithLastOrder? model) { if (model == null) { - return {}; + throw FormatException("Required field [model] cannot be null"); } return { 'name': model.name, diff --git a/packages/orm/angel_orm_test/lib/src/models/person_order.g.dart b/packages/orm/angel_orm_test/lib/src/models/person_order.g.dart index 8dddf199..3d11349a 100644 --- a/packages/orm/angel_orm_test/lib/src/models/person_order.g.dart +++ b/packages/orm/angel_orm_test/lib/src/models/person_order.g.dart @@ -577,7 +577,7 @@ class PersonOrderSerializer extends Codec { static Map toMap(_PersonOrder? model) { if (model == null) { - return {}; + throw FormatException("Required field [model] cannot be null"); } return { 'id': model.id, @@ -665,7 +665,7 @@ class OrderWithPersonInfoSerializer extends Codec { static Map toMap(_OrderWithPersonInfo? model) { if (model == null) { - return {}; + throw FormatException("Required field [model] cannot be null"); } return { 'id': model.id, diff --git a/packages/orm/angel_orm_test/lib/src/models/tree.g.dart b/packages/orm/angel_orm_test/lib/src/models/tree.g.dart index e0f2086d..c4a34e37 100644 --- a/packages/orm/angel_orm_test/lib/src/models/tree.g.dart +++ b/packages/orm/angel_orm_test/lib/src/models/tree.g.dart @@ -559,7 +559,7 @@ class TreeSerializer extends Codec { static Map toMap(_Tree? model) { if (model == null) { - return {}; + throw FormatException("Required field [model] cannot be null"); } return { 'id': model.id, @@ -633,7 +633,7 @@ class FruitSerializer extends Codec { static Map toMap(_Fruit? model) { if (model == null) { - return {}; + throw FormatException("Required field [model] cannot be null"); } return { 'id': model.id, diff --git a/packages/orm/angel_orm_test/lib/src/models/unorthodox.g.dart b/packages/orm/angel_orm_test/lib/src/models/unorthodox.g.dart index 3231efef..731da605 100644 --- a/packages/orm/angel_orm_test/lib/src/models/unorthodox.g.dart +++ b/packages/orm/angel_orm_test/lib/src/models/unorthodox.g.dart @@ -1260,7 +1260,7 @@ class UnorthodoxSerializer extends Codec { static Map toMap(_Unorthodox? model) { if (model == null) { - return {}; + throw FormatException("Required field [model] cannot be null"); } return {'name': model.name}; } @@ -1316,7 +1316,7 @@ class WeirdJoinSerializer extends Codec { static Map toMap(_WeirdJoin? model) { if (model == null) { - return {}; + throw FormatException("Required field [model] cannot be null"); } return { 'id': model.id, @@ -1390,7 +1390,7 @@ class SongSerializer extends Codec { static Map toMap(_Song? model) { if (model == null) { - return {}; + throw FormatException("Required field [model] cannot be null"); } return { 'id': model.id, @@ -1451,7 +1451,7 @@ class NumbaSerializer extends Codec { static Map toMap(_Numba? model) { if (model == null) { - return {}; + throw FormatException("Required field [model] cannot be null"); } return {'i': model.i, 'parent': model.parent}; } @@ -1500,7 +1500,7 @@ class FooSerializer extends Codec { static Map toMap(_Foo? model) { if (model == null) { - return {}; + throw FormatException("Required field [model] cannot be null"); } return { 'bar': model.bar, @@ -1553,7 +1553,7 @@ class FooPivotSerializer extends Codec { static Map toMap(_FooPivot? model) { if (model == null) { - return {}; + throw FormatException("Required field [model] cannot be null"); } return { 'weird_join': WeirdJoinSerializer.toMap(model.weirdJoin), diff --git a/packages/orm/angel_orm_test/lib/src/models/user.g.dart b/packages/orm/angel_orm_test/lib/src/models/user.g.dart index 4c883a9b..f88d37ee 100644 --- a/packages/orm/angel_orm_test/lib/src/models/user.g.dart +++ b/packages/orm/angel_orm_test/lib/src/models/user.g.dart @@ -859,7 +859,7 @@ class UserSerializer extends Codec { static Map toMap(_User? model) { if (model == null) { - return {}; + throw FormatException("Required field [model] cannot be null"); } return { 'id': model.id, @@ -934,7 +934,7 @@ class RoleUserSerializer extends Codec { static Map toMap(_RoleUser? model) { if (model == null) { - return {}; + throw FormatException("Required field [model] cannot be null"); } return { 'role': RoleSerializer.toMap(model.role), @@ -996,7 +996,7 @@ class RoleSerializer extends Codec { static Map toMap(_Role? model) { if (model == null) { - return {}; + throw FormatException("Required field [model] cannot be null"); } return { 'id': model.id, diff --git a/packages/orm/angel_orm_test/lib/src/models/world.g.dart b/packages/orm/angel_orm_test/lib/src/models/world.g.dart index da72ec89..5a0e29f7 100644 --- a/packages/orm/angel_orm_test/lib/src/models/world.g.dart +++ b/packages/orm/angel_orm_test/lib/src/models/world.g.dart @@ -201,7 +201,7 @@ class WorldSerializer extends Codec { static Map toMap(_World? model) { if (model == null) { - return {}; + throw FormatException("Required field [model] cannot be null"); } return {'id': model.id, 'random_number': model.randomNumber}; }