简体   繁体   English

在域对象约束中指定grails浮点精度,怎么办?

[英]Specifying grails floating point precision in domain object constraint, how?

I how do I say a field is of the following type and precision in grails constraint? 我如何说在grails约束下字段具有以下类型和精度?

FLOAT(7,4)

In mysql it means it will have value of something like xxx.yyyy , 3 decimal places to the left of dot and four decimal places to the right of the dot. 在mysql中,这意味着它将具有类似xxx.yyyy值, 在点的左侧保留3个小数位,在点的右侧保留4个小数位。

Set the max and scale constraints of your domain class property to influence the schema generation. 设置域类属性的maxscale约束以影响架构的生成。 The Grails documentation explains this in detail. Grails 文档对此进行了详细说明。

From the documentation: 从文档中:

 someFloatValue max: 1000000, scale: 3 

would yield: 将产生:

 someFloatValue DECIMAL(19, 3) // precision is default 

Note The above is directly from the Grails documentation but logically it should yield DECIMAL(9, 3) . 注意上面的内容直接来自Grails文档,但从逻辑DECIMAL(9, 3)应该产生DECIMAL(9, 3)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM