platform/packages/orm/angel_orm/example/main.serializer.g.dart

62 lines
1.7 KiB
Dart
Raw Normal View History

2018-12-01 17:21:34 +00:00
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'main.dart';
// **************************************************************************
// SerializerGenerator
// **************************************************************************
abstract class EmployeeSerializer {
static Employee fromMap(Map map) {
2019-07-04 21:30:21 +00:00
return Employee(
2021-05-02 07:32:24 +00:00
id: map['id'] as String?,
firstName: map['first_name'] as String?,
lastName: map['last_name'] as String?,
salary: map['salary'] as double?,
2018-12-01 17:21:34 +00:00
createdAt: map['created_at'] != null
? (map['created_at'] is DateTime
2021-05-02 07:32:24 +00:00
? (map['created_at'] as DateTime?)
2018-12-01 17:21:34 +00:00
: DateTime.parse(map['created_at'].toString()))
: null,
updatedAt: map['updated_at'] != null
? (map['updated_at'] is DateTime
2021-05-02 07:32:24 +00:00
? (map['updated_at'] as DateTime?)
2018-12-01 17:21:34 +00:00
: DateTime.parse(map['updated_at'].toString()))
: null);
}
static Map<String, dynamic> toMap(Employee model) {
return {
'id': model.id,
'first_name': model.firstName,
'last_name': model.lastName,
'salary': model.salary,
'created_at': model.createdAt?.toIso8601String(),
'updated_at': model.updatedAt?.toIso8601String()
};
}
}
abstract class EmployeeFields {
2019-07-04 21:30:21 +00:00
static const List<String> allFields = <String>[
2018-12-01 17:21:34 +00:00
id,
firstName,
lastName,
salary,
createdAt,
updatedAt
];
static const String id = 'id';
static const String firstName = 'first_name';
static const String lastName = 'last_name';
static const String salary = 'salary';
static const String createdAt = 'created_at';
static const String updatedAt = 'updated_at';
}