dart-bridge / trestle

Database Gateway and ORM for Dart
MIT License
26 stars 12 forks source link

Recognition of types. #3

Closed Bzik closed 8 years ago

Bzik commented 8 years ago

In database i have someSchema.numeric('points') in DTO @Field() double points;

If points, in database, are integer it doesn't cast it to double. That's why I cant use simple annotations and need to use data mapping :/

Also if string field contains value '1' it will be cast as integer not string.

emilniklas commented 8 years ago

Hello!

What database driver are you using? I can't find any place where I cast the type, so it probably lies in the driver implementation.

Bzik commented 8 years ago

I'm using PostgreSQL.

emilniklas commented 8 years ago

@Bzik I have looked this up, and Trestle actually never does anything to the types. This has to be from the PostgreSQL library itself. If a field is declared as floating number in the schema, then the queries should be returned parsed as such.

I would recommend you take this to https://github.com/xxgreg/dart_postgresql