Skip to content

SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.

Add ParseUint64 function

chrislusfc89b4fd18b80
diff --git a/go/util/parse.go b/go/util/parse.go
index 930da95223..0a8317c19e 100644
--- a/go/util/parse.go
+++ b/go/util/parse.go
@@ -5,7 +5,7 @@ import (
)
func ParseInt(text string, defaultValue int) int {
- count, parseError := strconv.ParseUint(text, 10, 64)
+ count, parseError := strconv.ParseInt(text, 10, 64)
if parseError != nil {
if len(text) > 0 {
return 0
@@ -14,3 +14,13 @@ func ParseInt(text string, defaultValue int) int {
}
return int(count)
}
+func ParseUint64(text string, defaultValue uint64) uint64 {
+ count, parseError := strconv.ParseUint(text, 10, 64)
+ if parseError != nil {
+ if len(text) > 0 {
+ return 0
+ }
+ return defaultValue
+ }
+ return count
+}