mirror of
https://github.com/datarhei/core.git
synced 2025-10-05 07:57:13 +08:00
WIP: allow update processes in cluster
This commit is contained in:
@@ -58,3 +58,15 @@ func lineAndCharacter(input []byte, offset int) (line int, character int, err er
|
||||
|
||||
return line, character, nil
|
||||
}
|
||||
|
||||
func ToNumber(f float64) json.Number {
|
||||
var s string
|
||||
|
||||
if f == float64(int64(f)) {
|
||||
s = fmt.Sprintf("%.0f", f) // 0 decimal if integer
|
||||
} else {
|
||||
s = fmt.Sprintf("%.3f", f) // max. 3 decimal if float
|
||||
}
|
||||
|
||||
return json.Number(s)
|
||||
}
|
||||
|
Reference in New Issue
Block a user