add SafeUint64 to units

This commit is contained in:
2026-06-26 20:31:56 +00:00
parent 372fd452c7
commit 41a06f6b45
+9
View File
@@ -2,6 +2,7 @@ package proxmoxaas_common_lib
import ( import (
"fmt" "fmt"
"log"
"math" "math"
"strings" "strings"
) )
@@ -48,3 +49,11 @@ func FormatNumber(val uint64, base uint64) (string, string) {
return "0", "" return "0", ""
} }
} }
func SafeUint64(i int) uint64 {
if i < 0 {
log.Printf("Tried to cast %d to uint64", i)
return 0
}
return uint64(i)
}