Fixed issue #75

This commit is contained in:
thomashii@dukefirehawk.com 2022-08-27 17:16:39 +08:00
parent cec05d8c19
commit 0301b300ad

View file

@ -299,6 +299,8 @@ class OrmGenerator extends GeneratorForAnnotation<Orm> {
} else if (fType.element2?.displayName == 'DateTime') { } else if (fType.element2?.displayName == 'DateTime') {
defaultRef = CodeExpression( defaultRef = CodeExpression(
Code('DateTime.parse("1970-01-01 00:00:00")')); Code('DateTime.parse("1970-01-01 00:00:00")'));
} else if (fType.isDartCoreList) {
defaultRef = CodeExpression(Code('[]'));
} }
} }
expr = refer('fields').property('contains').call([ expr = refer('fields').property('contains').call([
@ -881,7 +883,9 @@ class OrmGenerator extends GeneratorForAnnotation<Orm> {
.isAssignableFromType(fType)) { .isAssignableFromType(fType)) {
value = refer('json') value = refer('json')
.property('decode') .property('decode')
.call([value.asA(refer('String'))]).asA(refer('List')); .call([value.asA(refer('String'))])
.property('cast')
.call([]);
} else if (floatTypes.contains(ctx.columns[field.name]?.type)) { } else if (floatTypes.contains(ctx.columns[field.name]?.type)) {
value = refer('double') value = refer('double')
.property('tryParse') .property('tryParse')