Fixed postgreSQL failed test cases

This commit is contained in:
thomashii@dukefirehawk.com 2022-07-30 23:08:38 +08:00
parent 3db9c53fdd
commit c30609f955
21 changed files with 216 additions and 58 deletions

View file

@ -0,0 +1,53 @@
import 'dart:io';
import 'package:postgres/postgres.dart';
void main() async {
/*
* Granting permission in postgres
* grant all privileges on database orm_test to test;
* grant all privileges on sequence users_id_seq to test;
*/
print("=== Start 'postgres' driver test");
await testPgDriver().catchError((error, stackTrace) {
print(error);
});
print("=== End test");
print(" ");
exit(0);
}
Future<void> testPgDriver() async {
var conn = PostgreSQLConnection('localhost', 5432, 'orm_test',
username: 'test', password: 'test123');
await conn.open();
print(">Test Select All");
var result = await conn.query("SELECT * from users");
print("Total records: ${result.length}");
for (var row in result) {
print(row[0]);
for (var element in row) {
print(element);
}
}
print(">Test Insert");
var params = {
"username": "test",
"password": "test123",
"email": "test@demo.com",
"updatedAt": DateTime.parse("1970-01-01 00:00:00")
};
result = await conn.query(
"INSERT INTO users (username, password, email, updated_at) VALUES (@username, @password, @email, @updatedAt)",
substitutionValues: params);
//print("Last inserted ID: ${result.}");
//print(">Test Select By ID");
//result = await conn.query("SELECT * from users where id=@id",
// substitutionValues: {"id": result});
//print("Read record: ${result.length}");
}

View file

@ -8,5 +8,7 @@ published_to: none
dependencies: dependencies:
mysql1: ^0.20.0 mysql1: ^0.20.0
mysql_client: ^0.0.24 mysql_client: ^0.0.24
postgres: ^2.4.1
postgres_pool: ^2.1.3
dev_dependencies: dev_dependencies:
lints: ^1.0.0 lints: ^1.0.0

View file

@ -22,6 +22,8 @@ String mapToText(dynamic value) {
return value; return value;
} }
/// Helper method to convert dynamic value to DateTime.
/// If null return January 1st, 1970 at 00:00:00 UTC as default
DateTime mapToDateTime(dynamic value) { DateTime mapToDateTime(dynamic value) {
if (value == null) { if (value == null) {
return defaultDate; return defaultDate;
@ -32,6 +34,14 @@ DateTime mapToDateTime(dynamic value) {
return value; return value;
} }
/// Helper method to convert dynamic value to nullable DateTime
DateTime? mapToNullableDateTime(dynamic value) {
if (value is String) {
return DateTime.tryParse(value);
}
return value;
}
double mapToDouble(dynamic value) { double mapToDouble(dynamic value) {
if (value == null) { if (value == null) {
return 0.0; return 0.0;

View file

@ -274,9 +274,12 @@ class OrmGenerator extends GeneratorForAnnotation<Orm> {
// Generated Code: mapToBool(row[i]) // Generated Code: mapToBool(row[i])
expr = refer('mapToBool').call([expr]); expr = refer('mapToBool').call([expr]);
} else if (fType.element?.displayName == 'DateTime') { } else if (fType.element?.displayName == 'DateTime') {
// print("fType: ${fType.element?.displayName}");
// Generated Code: mapToDateTime(row[i]) // Generated Code: mapToDateTime(row[i])
if (fType.nullabilitySuffix == NullabilitySuffix.question) {
expr = refer('mapToNullableDateTime').call([expr]);
} else {
expr = refer('mapToDateTime').call([expr]); expr = refer('mapToDateTime').call([expr]);
}
} else { } else {
// Generated Code: (row[i] as type?) // Generated Code: (row[i] as type?)
expr = expr.asA(type); expr = expr.asA(type);

View file

@ -13,8 +13,8 @@ part 'main.g.dart';
void main() async { void main() async {
//hierarchicalLoggingEnabled = true; //hierarchicalLoggingEnabled = true;
await mariaDBExample(); //await mariaDBExample();
//await mysqlExample(); await mysqlExample();
exit(0); exit(0);
} }
@ -62,7 +62,7 @@ Future<void> mysqlExample() async {
databaseName: "orm_test", databaseName: "orm_test",
userName: "test", userName: "test",
password: "test123", password: "test123",
secure: false); secure: true);
print("Connected to MySQL"); print("Connected to MySQL");
var logger = Logger('orm_mysql'); var logger = Logger('orm_mysql');

View file

@ -17,8 +17,8 @@ dev_dependencies:
test: ^1.21.0 test: ^1.21.0
lints: ^1.0.0 lints: ^1.0.0
dependency_overrides: dependency_overrides:
# angel3_serialize: angel3_serialize:
# path: ../../serialize/angel_serialize path: ../../serialize/angel_serialize
# angel3_model: # angel3_model:
# path: ../../model # path: ../../model
angel3_orm_test: angel3_orm_test:

View file

@ -99,8 +99,12 @@ class ItemQuery extends Query<Item, ItemQueryWhere> {
} }
var model = Item( var model = Item(
id: fields.contains('id') ? row[0].toString() : null, id: fields.contains('id') ? row[0].toString() : null,
createdAt: fields.contains('created_at') ? mapToDateTime(row[1]) : null, createdAt: fields.contains('created_at')
updatedAt: fields.contains('updated_at') ? mapToDateTime(row[2]) : null, ? mapToNullableDateTime(row[1])
: null,
updatedAt: fields.contains('updated_at')
? mapToNullableDateTime(row[2])
: null,
description: fields.contains('description') ? (row[3] as String) : ''); description: fields.contains('description') ? (row[3] as String) : '');
return Optional.of(model); return Optional.of(model);
} }
@ -236,8 +240,12 @@ class AssetQuery extends Query<Asset, AssetQueryWhere> {
} }
var model = Asset( var model = Asset(
id: fields.contains('id') ? row[0].toString() : null, id: fields.contains('id') ? row[0].toString() : null,
createdAt: fields.contains('created_at') ? mapToDateTime(row[1]) : null, createdAt: fields.contains('created_at')
updatedAt: fields.contains('updated_at') ? mapToDateTime(row[2]) : null, ? mapToNullableDateTime(row[1])
: null,
updatedAt: fields.contains('updated_at')
? mapToNullableDateTime(row[2])
: null,
description: fields.contains('description') ? (row[3] as String) : '', description: fields.contains('description') ? (row[3] as String) : '',
name: fields.contains('name') ? (row[4] as String) : '', name: fields.contains('name') ? (row[4] as String) : '',
price: fields.contains('price') ? mapToDouble(row[5]) : 0.0); price: fields.contains('price') ? mapToDouble(row[5]) : 0.0);

View file

@ -95,8 +95,12 @@ class BikeQuery extends Query<Bike, BikeQueryWhere> {
} }
var model = Bike( var model = Bike(
id: fields.contains('id') ? row[0].toString() : null, id: fields.contains('id') ? row[0].toString() : null,
createdAt: fields.contains('created_at') ? mapToDateTime(row[1]) : null, createdAt: fields.contains('created_at')
updatedAt: fields.contains('updated_at') ? mapToDateTime(row[2]) : null, ? mapToNullableDateTime(row[1])
: null,
updatedAt: fields.contains('updated_at')
? mapToNullableDateTime(row[2])
: null,
make: fields.contains('make') ? (row[3] as String) : '', make: fields.contains('make') ? (row[3] as String) : '',
description: fields.contains('description') ? (row[4] as String) : '', description: fields.contains('description') ? (row[4] as String) : '',
familyFriendly: familyFriendly:

View file

@ -95,8 +95,12 @@ class BoatQuery extends Query<Boat, BoatQueryWhere> {
} }
var model = Boat( var model = Boat(
id: fields.contains('id') ? row[0].toString() : null, id: fields.contains('id') ? row[0].toString() : null,
createdAt: fields.contains('created_at') ? mapToDateTime(row[1]) : null, createdAt: fields.contains('created_at')
updatedAt: fields.contains('updated_at') ? mapToDateTime(row[2]) : null, ? mapToNullableDateTime(row[1])
: null,
updatedAt: fields.contains('updated_at')
? mapToNullableDateTime(row[2])
: null,
make: fields.contains('make') ? (row[3] as String) : '', make: fields.contains('make') ? (row[3] as String) : '',
description: fields.contains('description') ? (row[4] as String) : '', description: fields.contains('description') ? (row[4] as String) : '',
familyFriendly: familyFriendly:

View file

@ -122,8 +122,12 @@ class BookQuery extends Query<Book, BookQueryWhere> {
} }
var model = Book( var model = Book(
id: fields.contains('id') ? row[0].toString() : null, id: fields.contains('id') ? row[0].toString() : null,
createdAt: fields.contains('created_at') ? mapToDateTime(row[1]) : null, createdAt: fields.contains('created_at')
updatedAt: fields.contains('updated_at') ? mapToDateTime(row[2]) : null, ? mapToNullableDateTime(row[1])
: null,
updatedAt: fields.contains('updated_at')
? mapToNullableDateTime(row[2])
: null,
name: fields.contains('name') ? (row[5] as String?) : null); name: fields.contains('name') ? (row[5] as String?) : null);
if (row.length > 6) { if (row.length > 6) {
var modelOpt = AuthorQuery().parseRow(row.skip(6).take(4).toList()); var modelOpt = AuthorQuery().parseRow(row.skip(6).take(4).toList());
@ -285,8 +289,12 @@ class AuthorQuery extends Query<Author, AuthorQueryWhere> {
} }
var model = Author( var model = Author(
id: fields.contains('id') ? row[0].toString() : null, id: fields.contains('id') ? row[0].toString() : null,
createdAt: fields.contains('created_at') ? mapToDateTime(row[1]) : null, createdAt: fields.contains('created_at')
updatedAt: fields.contains('updated_at') ? mapToDateTime(row[2]) : null, ? mapToNullableDateTime(row[1])
: null,
updatedAt: fields.contains('updated_at')
? mapToNullableDateTime(row[2])
: null,
name: fields.contains('name') ? (row[3] as String?) : null); name: fields.contains('name') ? (row[3] as String?) : null);
return Optional.of(model); return Optional.of(model);
} }

View file

@ -91,15 +91,20 @@ class CarQuery extends Query<Car, CarQueryWhere> {
} }
var model = Car( var model = Car(
id: fields.contains('id') ? row[0].toString() : null, id: fields.contains('id') ? row[0].toString() : null,
createdAt: fields.contains('created_at') ? mapToDateTime(row[1]) : null, createdAt: fields.contains('created_at')
updatedAt: fields.contains('updated_at') ? mapToDateTime(row[2]) : null, ? mapToNullableDateTime(row[1])
: null,
updatedAt: fields.contains('updated_at')
? mapToNullableDateTime(row[2])
: null,
make: fields.contains('make') ? (row[3] as String?) : null, make: fields.contains('make') ? (row[3] as String?) : null,
description: description:
fields.contains('description') ? (row[4] as String?) : null, fields.contains('description') ? (row[4] as String?) : null,
familyFriendly: familyFriendly:
fields.contains('family_friendly') ? mapToBool(row[5]) : null, fields.contains('family_friendly') ? mapToBool(row[5]) : null,
recalledAt: recalledAt: fields.contains('recalled_at')
fields.contains('recalled_at') ? mapToDateTime(row[6]) : null); ? mapToNullableDateTime(row[6])
: null);
return Optional.of(model); return Optional.of(model);
} }

View file

@ -101,8 +101,12 @@ class NumbersQuery extends Query<Numbers, NumbersQueryWhere> {
} }
var model = Numbers( var model = Numbers(
id: fields.contains('id') ? row[0].toString() : null, id: fields.contains('id') ? row[0].toString() : null,
createdAt: fields.contains('created_at') ? mapToDateTime(row[1]) : null, createdAt: fields.contains('created_at')
updatedAt: fields.contains('updated_at') ? mapToDateTime(row[2]) : null, ? mapToNullableDateTime(row[1])
: null,
updatedAt: fields.contains('updated_at')
? mapToNullableDateTime(row[2])
: null,
two: fields.contains('two') ? (row[3] as int?) : null); two: fields.contains('two') ? (row[3] as int?) : null);
return Optional.of(model); return Optional.of(model);
} }
@ -218,8 +222,12 @@ class AlphabetQuery extends Query<Alphabet, AlphabetQueryWhere> {
} }
var model = Alphabet( var model = Alphabet(
id: fields.contains('id') ? row[0].toString() : null, id: fields.contains('id') ? row[0].toString() : null,
createdAt: fields.contains('created_at') ? mapToDateTime(row[1]) : null, createdAt: fields.contains('created_at')
updatedAt: fields.contains('updated_at') ? mapToDateTime(row[2]) : null, ? mapToNullableDateTime(row[1])
: null,
updatedAt: fields.contains('updated_at')
? mapToNullableDateTime(row[2])
: null,
value: fields.contains('value') ? (row[3] as String?) : null); value: fields.contains('value') ? (row[3] as String?) : null);
if (row.length > 5) { if (row.length > 5) {
var modelOpt = NumbersQuery().parseRow(row.skip(5).take(4).toList()); var modelOpt = NumbersQuery().parseRow(row.skip(5).take(4).toList());

View file

@ -81,8 +81,12 @@ class HasCarQuery extends Query<HasCar, HasCarQueryWhere> {
} }
var model = HasCar( var model = HasCar(
id: fields.contains('id') ? row[0].toString() : null, id: fields.contains('id') ? row[0].toString() : null,
createdAt: fields.contains('created_at') ? mapToDateTime(row[1]) : null, createdAt: fields.contains('created_at')
updatedAt: fields.contains('updated_at') ? mapToDateTime(row[2]) : null, ? mapToNullableDateTime(row[1])
: null,
updatedAt: fields.contains('updated_at')
? mapToNullableDateTime(row[2])
: null,
type: fields.contains('type') type: fields.contains('type')
? row[3] == null ? row[3] == null
? null ? null

View file

@ -110,8 +110,12 @@ class LegQuery extends Query<Leg, LegQueryWhere> {
} }
var model = Leg( var model = Leg(
id: fields.contains('id') ? row[0].toString() : null, id: fields.contains('id') ? row[0].toString() : null,
createdAt: fields.contains('created_at') ? mapToDateTime(row[1]) : null, createdAt: fields.contains('created_at')
updatedAt: fields.contains('updated_at') ? mapToDateTime(row[2]) : null, ? mapToNullableDateTime(row[1])
: null,
updatedAt: fields.contains('updated_at')
? mapToNullableDateTime(row[2])
: null,
name: fields.contains('name') ? (row[3] as String?) : null); name: fields.contains('name') ? (row[3] as String?) : null);
if (row.length > 4) { if (row.length > 4) {
var modelOpt = FootQuery().parseRow(row.skip(4).take(5).toList()); var modelOpt = FootQuery().parseRow(row.skip(4).take(5).toList());
@ -239,8 +243,12 @@ class FootQuery extends Query<Foot, FootQueryWhere> {
} }
var model = Foot( var model = Foot(
id: fields.contains('id') ? row[0].toString() : null, id: fields.contains('id') ? row[0].toString() : null,
createdAt: fields.contains('created_at') ? mapToDateTime(row[1]) : null, createdAt: fields.contains('created_at')
updatedAt: fields.contains('updated_at') ? mapToDateTime(row[2]) : null, ? mapToNullableDateTime(row[1])
: null,
updatedAt: fields.contains('updated_at')
? mapToNullableDateTime(row[2])
: null,
legId: fields.contains('leg_id') ? (row[3] as int?) : null, legId: fields.contains('leg_id') ? (row[3] as int?) : null,
nToes: fields.contains('n_toes') ? mapToDouble(row[4]) : null); nToes: fields.contains('n_toes') ? mapToDouble(row[4]) : null);
return Optional.of(model); return Optional.of(model);

View file

@ -115,10 +115,16 @@ class OrderQuery extends Query<Order, OrderQueryWhere> {
} }
var model = Order( var model = Order(
id: fields.contains('id') ? row[0].toString() : null, id: fields.contains('id') ? row[0].toString() : null,
createdAt: fields.contains('created_at') ? mapToDateTime(row[1]) : null, createdAt: fields.contains('created_at')
updatedAt: fields.contains('updated_at') ? mapToDateTime(row[2]) : null, ? mapToNullableDateTime(row[1])
: null,
updatedAt: fields.contains('updated_at')
? mapToNullableDateTime(row[2])
: null,
employeeId: fields.contains('employee_id') ? (row[4] as int?) : null, employeeId: fields.contains('employee_id') ? (row[4] as int?) : null,
orderDate: fields.contains('order_date') ? mapToDateTime(row[5]) : null, orderDate: fields.contains('order_date')
? mapToNullableDateTime(row[5])
: null,
shipperId: fields.contains('shipper_id') ? (row[6] as int?) : null); shipperId: fields.contains('shipper_id') ? (row[6] as int?) : null);
if (row.length > 7) { if (row.length > 7) {
var modelOpt = CustomerQuery().parseRow(row.skip(7).take(3).toList()); var modelOpt = CustomerQuery().parseRow(row.skip(7).take(3).toList());
@ -284,9 +290,12 @@ class CustomerQuery extends Query<Customer, CustomerQueryWhere> {
} }
var model = Customer( var model = Customer(
id: fields.contains('id') ? row[0].toString() : null, id: fields.contains('id') ? row[0].toString() : null,
createdAt: fields.contains('created_at') ? mapToDateTime(row[1]) : null, createdAt: fields.contains('created_at')
updatedAt: ? mapToNullableDateTime(row[1])
fields.contains('updated_at') ? mapToDateTime(row[2]) : null); : null,
updatedAt: fields.contains('updated_at')
? mapToNullableDateTime(row[2])
: null);
return Optional.of(model); return Optional.of(model);
} }

View file

@ -82,8 +82,12 @@ class PersonQuery extends Query<Person, PersonQueryWhere> {
} }
var model = Person( var model = Person(
id: fields.contains('id') ? row[0].toString() : null, id: fields.contains('id') ? row[0].toString() : null,
createdAt: fields.contains('created_at') ? mapToDateTime(row[1]) : null, createdAt: fields.contains('created_at')
updatedAt: fields.contains('updated_at') ? mapToDateTime(row[2]) : null, ? mapToNullableDateTime(row[1])
: null,
updatedAt: fields.contains('updated_at')
? mapToNullableDateTime(row[2])
: null,
name: fields.contains('name') ? (row[3] as String?) : null, name: fields.contains('name') ? (row[3] as String?) : null,
age: fields.contains('age') ? (row[4] as int?) : null); age: fields.contains('age') ? (row[4] as int?) : null);
return Optional.of(model); return Optional.of(model);

View file

@ -92,8 +92,12 @@ class PersonOrderQuery extends Query<PersonOrder, PersonOrderQueryWhere> {
} }
var model = PersonOrder( var model = PersonOrder(
id: fields.contains('id') ? row[0].toString() : null, id: fields.contains('id') ? row[0].toString() : null,
createdAt: fields.contains('created_at') ? mapToDateTime(row[1]) : null, createdAt: fields.contains('created_at')
updatedAt: fields.contains('updated_at') ? mapToDateTime(row[2]) : null, ? mapToNullableDateTime(row[1])
: null,
updatedAt: fields.contains('updated_at')
? mapToNullableDateTime(row[2])
: null,
personId: fields.contains('person_id') ? (row[3] as int?) : null, personId: fields.contains('person_id') ? (row[3] as int?) : null,
name: fields.contains('name') ? (row[4] as String?) : null, name: fields.contains('name') ? (row[4] as String?) : null,
price: fields.contains('price') ? mapToDouble(row[5]) : null, price: fields.contains('price') ? mapToDouble(row[5]) : null,
@ -255,8 +259,12 @@ class OrderWithPersonInfoQuery
} }
var model = OrderWithPersonInfo( var model = OrderWithPersonInfo(
id: fields.contains('id') ? row[0].toString() : null, id: fields.contains('id') ? row[0].toString() : null,
createdAt: fields.contains('created_at') ? mapToDateTime(row[1]) : null, createdAt: fields.contains('created_at')
updatedAt: fields.contains('updated_at') ? mapToDateTime(row[2]) : null, ? mapToNullableDateTime(row[1])
: null,
updatedAt: fields.contains('updated_at')
? mapToNullableDateTime(row[2])
: null,
name: fields.contains('name') ? (row[3] as String?) : null, name: fields.contains('name') ? (row[3] as String?) : null,
price: fields.contains('price') ? mapToDouble(row[4]) : null, price: fields.contains('price') ? mapToDouble(row[4]) : null,
deleted: fields.contains('deleted') ? mapToBool(row[5]) : null, deleted: fields.contains('deleted') ? mapToBool(row[5]) : null,

View file

@ -110,8 +110,12 @@ class TreeQuery extends Query<Tree, TreeQueryWhere> {
} }
var model = Tree( var model = Tree(
id: fields.contains('id') ? row[0].toString() : null, id: fields.contains('id') ? row[0].toString() : null,
createdAt: fields.contains('created_at') ? mapToDateTime(row[1]) : null, createdAt: fields.contains('created_at')
updatedAt: fields.contains('updated_at') ? mapToDateTime(row[2]) : null, ? mapToNullableDateTime(row[1])
: null,
updatedAt: fields.contains('updated_at')
? mapToNullableDateTime(row[2])
: null,
rings: fields.contains('rings') ? (row[3] as int?) : null); rings: fields.contains('rings') ? (row[3] as int?) : null);
if (row.length > 4) { if (row.length > 4) {
var modelOpt = FruitQuery().parseRow(row.skip(4).take(5).toList()); var modelOpt = FruitQuery().parseRow(row.skip(4).take(5).toList());
@ -299,8 +303,12 @@ class FruitQuery extends Query<Fruit, FruitQueryWhere> {
} }
var model = Fruit( var model = Fruit(
id: fields.contains('id') ? row[0].toString() : null, id: fields.contains('id') ? row[0].toString() : null,
createdAt: fields.contains('created_at') ? mapToDateTime(row[1]) : null, createdAt: fields.contains('created_at')
updatedAt: fields.contains('updated_at') ? mapToDateTime(row[2]) : null, ? mapToNullableDateTime(row[1])
: null,
updatedAt: fields.contains('updated_at')
? mapToNullableDateTime(row[2])
: null,
treeId: fields.contains('tree_id') ? (row[3] as int?) : null, treeId: fields.contains('tree_id') ? (row[3] as int?) : null,
commonName: commonName:
fields.contains('common_name') ? (row[4] as String?) : null); fields.contains('common_name') ? (row[4] as String?) : null);

View file

@ -486,8 +486,12 @@ class SongQuery extends Query<Song, SongQueryWhere> {
} }
var model = Song( var model = Song(
id: fields.contains('id') ? row[0].toString() : null, id: fields.contains('id') ? row[0].toString() : null,
createdAt: fields.contains('created_at') ? mapToDateTime(row[1]) : null, createdAt: fields.contains('created_at')
updatedAt: fields.contains('updated_at') ? mapToDateTime(row[2]) : null, ? mapToNullableDateTime(row[1])
: null,
updatedAt: fields.contains('updated_at')
? mapToNullableDateTime(row[2])
: null,
weirdJoinId: fields.contains('weird_join_id') ? (row[3] as int?) : null, weirdJoinId: fields.contains('weird_join_id') ? (row[3] as int?) : null,
title: fields.contains('title') ? (row[4] as String?) : null); title: fields.contains('title') ? (row[4] as String?) : null);
return Optional.of(model); return Optional.of(model);

View file

@ -127,8 +127,12 @@ class UserQuery extends Query<User, UserQueryWhere> {
} }
var model = User( var model = User(
id: fields.contains('id') ? row[0].toString() : null, id: fields.contains('id') ? row[0].toString() : null,
createdAt: fields.contains('created_at') ? mapToDateTime(row[1]) : null, createdAt: fields.contains('created_at')
updatedAt: fields.contains('updated_at') ? mapToDateTime(row[2]) : null, ? mapToNullableDateTime(row[1])
: null,
updatedAt: fields.contains('updated_at')
? mapToNullableDateTime(row[2])
: null,
username: fields.contains('username') ? (row[3] as String?) : null, username: fields.contains('username') ? (row[3] as String?) : null,
password: fields.contains('password') ? (row[4] as String?) : null, password: fields.contains('password') ? (row[4] as String?) : null,
email: fields.contains('email') ? (row[5] as String?) : null); email: fields.contains('email') ? (row[5] as String?) : null);
@ -487,8 +491,12 @@ class RoleQuery extends Query<Role, RoleQueryWhere> {
} }
var model = Role( var model = Role(
id: fields.contains('id') ? row[0].toString() : null, id: fields.contains('id') ? row[0].toString() : null,
createdAt: fields.contains('created_at') ? mapToDateTime(row[1]) : null, createdAt: fields.contains('created_at')
updatedAt: fields.contains('updated_at') ? mapToDateTime(row[2]) : null, ? mapToNullableDateTime(row[1])
: null,
updatedAt: fields.contains('updated_at')
? mapToNullableDateTime(row[2])
: null,
name: fields.contains('name') ? (row[3] as String?) : null); name: fields.contains('name') ? (row[3] as String?) : null);
if (row.length > 4) { if (row.length > 4) {
var modelOpt = UserQuery().parseRow(row.skip(4).take(6).toList()); var modelOpt = UserQuery().parseRow(row.skip(4).take(6).toList());