Skip to content

shopspring/decimal support #279

@El-76

Description

@El-76

Is your feature request related to a problem? Please describe.
We widely use shopspring/decimal as an internal standard to handle fixed-point numbers, so would like to have it supported in the driver.

Describe the solution you'd like
The driver supports Decimal and NullDecimal from the library. I'm ready to provide impementation while need some guidance. If the library couldn't be integrated into the driver as a 3rd party dependency (considered non-standard or whatever), I'll likely fork the driver, so it also would be great if you provide some notes on how to properly implement in such case.

Describe alternatives you've considered
Using Decimal as is - it returns a string in its Value() func, plus implementing our own NullDecimal that mimics NULL by passing some typed value for NULL parameters - "NULL" string for example. Looks ugly and maybe slow due to extra conversions.

Additional context
Despite the library structs support Scanner / Valuer abstraction, straightforward use of NullDecimal from the library breaks for NULL values likely due to type information loss. Also TVPs do not work.

Looks like makeParam requires some knowledge as it has, say, for UniqueIdentifier / NullUniqueIdentifier.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions