Updated ORM

This commit is contained in:
thomashii 2022-02-27 12:30:22 +08:00
parent 0dc71df45a
commit 174388e075
16 changed files with 34 additions and 34 deletions

View file

@ -48,7 +48,7 @@ class EmployeeQuery extends Query<Employee, EmployeeQueryWhere> {
@override
Map<String, String> get casts {
return {'salary': 'text'};
return {'salary': 'char'};
}
@override
@ -324,7 +324,7 @@ class EmployeeSerializer extends Codec<Employee, Map> {
static Map<String, dynamic> toMap(_Employee? model) {
if (model == null) {
return {};
throw FormatException("Required field [model] cannot be null");
}
return {
'id': model.id,

View file

@ -531,7 +531,7 @@ class BookSerializer extends Codec<Book, Map> {
static Map<String, dynamic> 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<Author, Map> {
static Map<String, dynamic> toMap(_Author? model) {
if (model == null) {
return {};
throw FormatException("Required field [model] cannot be null");
}
return {
'id': model.id,

View file

@ -342,7 +342,7 @@ class CarSerializer extends Codec<Car, Map> {
static Map<String, dynamic> toMap(_Car? model) {
if (model == null) {
return {};
throw FormatException("Required field [model] cannot be null");
}
return {
'id': model.id,

View file

@ -467,7 +467,7 @@ class NumbersSerializer extends Codec<Numbers, Map> {
static Map<String, dynamic> 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<Alphabet, Map> {
static Map<String, dynamic> toMap(_Alphabet? model) {
if (model == null) {
return {};
throw FormatException("Required field [model] cannot be null");
}
return {
'id': model.id,

View file

@ -700,7 +700,7 @@ class RoleSerializer extends Codec<Role, Map> {
static Map<String, dynamic> 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<RoleUser, Map> {
static Map<String, dynamic> 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<User, Map> {
static Map<String, dynamic> toMap(_User? model) {
if (model == null) {
return {};
throw FormatException("Required field [model] cannot be null");
}
return {
'email': model.email,

View file

@ -197,7 +197,7 @@ class FortuneSerializer extends Codec<Fortune, Map> {
static Map<String, dynamic> toMap(_Fortune? model) {
if (model == null) {
return {};
throw FormatException("Required field [model] cannot be null");
}
return {'id': model.id, 'message': model.message};
}

View file

@ -253,7 +253,7 @@ class HasCarSerializer extends Codec<HasCar, Map> {
: 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<HasCar, Map> {
static Map<String, dynamic> toMap(_HasCar? model) {
if (model == null) {
return {};
throw FormatException("Required field [model] cannot be null");
}
return {
'id': model.id,

View file

@ -211,7 +211,7 @@ class HasMapSerializer extends Codec<HasMap, Map> {
static Map<String, dynamic> toMap(_HasMap? model) {
if (model == null) {
return {};
throw FormatException("Required field [model] cannot be null");
}
return {'value': model.value, 'list': model.list};
}

View file

@ -492,7 +492,7 @@ class LegSerializer extends Codec<Leg, Map> {
static Map<String, dynamic> 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<Foot, Map> {
static Map<String, dynamic> toMap(_Foot? model) {
if (model == null) {
return {};
throw FormatException("Required field [model] cannot be null");
}
return {
'id': model.id,

View file

@ -526,7 +526,7 @@ class OrderSerializer extends Codec<Order, Map> {
static Map<String, dynamic> 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<Customer, Map> {
static Map<String, dynamic> toMap(_Customer? model) {
if (model == null) {
return {};
throw FormatException("Required field [model] cannot be null");
}
return {
'id': model.id,

View file

@ -412,7 +412,7 @@ class PersonSerializer extends Codec<Person, Map> {
static Map<String, dynamic> 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<PersonWithLastOrder, Map> {
static Map<String, dynamic> toMap(_PersonWithLastOrder? model) {
if (model == null) {
return {};
throw FormatException("Required field [model] cannot be null");
}
return {
'name': model.name,

View file

@ -577,7 +577,7 @@ class PersonOrderSerializer extends Codec<PersonOrder, Map> {
static Map<String, dynamic> 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<OrderWithPersonInfo, Map> {
static Map<String, dynamic> toMap(_OrderWithPersonInfo? model) {
if (model == null) {
return {};
throw FormatException("Required field [model] cannot be null");
}
return {
'id': model.id,

View file

@ -559,7 +559,7 @@ class TreeSerializer extends Codec<Tree, Map> {
static Map<String, dynamic> 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<Fruit, Map> {
static Map<String, dynamic> toMap(_Fruit? model) {
if (model == null) {
return {};
throw FormatException("Required field [model] cannot be null");
}
return {
'id': model.id,

View file

@ -1260,7 +1260,7 @@ class UnorthodoxSerializer extends Codec<Unorthodox, Map> {
static Map<String, dynamic> 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<WeirdJoin, Map> {
static Map<String, dynamic> 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<Song, Map> {
static Map<String, dynamic> 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<Numba, Map> {
static Map<String, dynamic> 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<Foo, Map> {
static Map<String, dynamic> 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<FooPivot, Map> {
static Map<String, dynamic> toMap(_FooPivot? model) {
if (model == null) {
return {};
throw FormatException("Required field [model] cannot be null");
}
return {
'weird_join': WeirdJoinSerializer.toMap(model.weirdJoin),

View file

@ -859,7 +859,7 @@ class UserSerializer extends Codec<User, Map> {
static Map<String, dynamic> 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<RoleUser, Map> {
static Map<String, dynamic> 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<Role, Map> {
static Map<String, dynamic> toMap(_Role? model) {
if (model == null) {
return {};
throw FormatException("Required field [model] cannot be null");
}
return {
'id': model.id,

View file

@ -201,7 +201,7 @@ class WorldSerializer extends Codec<World, Map> {
static Map<String, dynamic> toMap(_World? model) {
if (model == null) {
return {};
throw FormatException("Required field [model] cannot be null");
}
return {'id': model.id, 'random_number': model.randomNumber};
}