简体   繁体   中英

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?

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.

Set the max and scale constraints of your domain class property to influence the schema generation. The Grails documentation explains this in detail.

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) .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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