Jaymon / prom

A PostgreSQL or SQLite orm for Python
MIT License
22 stars 4 forks source link

Casting Decimal instances to int when appropriate #162

Closed Jaymon closed 1 year ago

Jaymon commented 1 year ago

I've got a field like this:

    foo = Field(
        int,
        True,
        precision=78,
        iget=lambda orm, val: int(val),
    )

This gets pulled out of Postgres as a decimal.Decimal instance, I'm wondering if iget should just handle this case automatically, basically if iget gets a Decimal it should check the type and then cast it if it isn't a Decimal type.