mirror of https://github.com/AMT-Cheif/drift.git
Allow reading bigints as doubles
This commit is contained in:
parent
3ecee4fb1f
commit
d694b64e72
|
@ -191,6 +191,8 @@ class SqlTypes {
|
|||
}
|
||||
return sqlValue as T;
|
||||
case DriftSqlType.double:
|
||||
if (sqlValue case final BigInt bi) return bi.toDouble() as T;
|
||||
|
||||
return (sqlValue as num?)?.toDouble() as T;
|
||||
case DriftSqlType.any:
|
||||
return DriftAny(sqlValue) as T;
|
||||
|
|
|
@ -14,6 +14,11 @@ void main() {
|
|||
expect(typeSystem.read(drift.DriftSqlType.double, null), isNull);
|
||||
});
|
||||
|
||||
test('can read BigInt', () {
|
||||
expect(typeSystem.read(drift.DriftSqlType.double, BigInt.parse('12345')),
|
||||
12345.0);
|
||||
});
|
||||
|
||||
test('can be mapped to sql constants', () {
|
||||
expect(typeSystem.mapToSqlLiteral(1.123), '1.123');
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue