schemix icon indicating copy to clipboard operation
schemix copied to clipboard

Support passing decimal precisions

Open zygopleural opened this issue 2 years ago • 0 comments

At the moment, if I want to define FPP, I need to do:

const Probability = createModel((Probability) => {
  Probability
    .string("id", { id: true })
    .decimal("probability", { raw: "@database.Decimal(3, 2)" })
})

It would be nice to support

const Probability = createModel((Probability) => {
  Probability
    .string("id", { id: true })
    .decimal("probability", 3, 2)
})

or

const Probability = createModel((Probability) => {
  Probability
    .string("id", { id: true })
    .decimal("probability", { precision: [3, 2] })
})

In order to add the "@database.Decimal(3, 2)" automatically.

zygopleural avatar Sep 30 '22 10:09 zygopleural