mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-07 22:49:26 +08:00
Merge branch 'main' into next
This commit is contained in:
commit
978927f768
@ -66,6 +66,19 @@ export class DecimalField extends NumberField {
|
|||||||
get dataType() {
|
get dataType() {
|
||||||
return DataTypes.DECIMAL(this.options.precision, this.options.scale);
|
return DataTypes.DECIMAL(this.options.precision, this.options.scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static optionsFromRawType(rawType: string) {
|
||||||
|
// infer precision and scale from rawType
|
||||||
|
// eg: DECIMAL(10, 2)
|
||||||
|
const matches = rawType.match(/DECIMAL\((\d+),\s*(\d+)\)/);
|
||||||
|
|
||||||
|
if (matches) {
|
||||||
|
return {
|
||||||
|
precision: parseInt(matches[1]),
|
||||||
|
scale: parseInt(matches[2]),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DecimalFieldOptions extends BaseColumnFieldOptions {
|
export interface DecimalFieldOptions extends BaseColumnFieldOptions {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user