docs: document float property (for v2.1.2) (#10575)

This commit is contained in:
Shahed Nasser
2024-12-17 17:13:17 +02:00
committed by GitHub
parent 632c340bf5
commit 8ded7fd781
2 changed files with 40 additions and 1 deletions
@@ -69,10 +69,49 @@ export default MyCustom
---
## float
<Note>
This property is only available after [Medusa v2.1.2](https://github.com/medusajs/medusa/releases/tag/v2.1.2).
</Note>
The `float` method defines a number property that allows for values with decimal places.
<Note title="Tip">
Use this property type when it's less important to have high precision for numbers with large decimal places. Alternatively, for higher percision, use the [bigNumber property](#bignumber).
</Note>
For example:
export const floatHighlights = [["4", "float", "Define a `float` property."]]
```ts highlights={floatHighlights}
import { model } from "@medusajs/framework/utils"
const MyCustom = model.define("my_custom", {
rating: model.float(),
// ...
})
export default MyCustom
```
---
## bigNumber
The `bigNumber` method defines a number property that expects large numbers, such as prices.
<Note title="Tip">
Use this property type when it's important to have high precision for numbers with large decimal places. Alternatively, for less percision, use the [float property](#float).
</Note>
For example:
export const bigNumberHighlights = [["4", "bigNumber", "Define a `bigNumber` property."]]