This commit is contained in:
aozhiwei 2024-06-25 20:50:19 +08:00
parent 763b161e26
commit 8877d9e02a
2 changed files with 22 additions and 0 deletions

View File

@ -140,3 +140,15 @@ func AdjustRangeValue[T int | int32 | int64 | float32 | float64](value T, minV T
func IsWeb3ZeroAddress(address string) bool {
return address == "0x0000000000000000000000000000000000000000"
}
func BigIntStrCmp(a string, b string) int {
if len(a) == len(b) {
return strings.Compare(a, b)
} else {
if len(a) < len(b) {
return -1
} else {
return 1
}
}
}

View File

@ -12,6 +12,7 @@ import (
"sync"
"runtime"
"hash/crc32"
"bufio"
)
func GetDaySeconds(seconds int64, timeZone int64) int64 {
@ -298,6 +299,15 @@ func SmartParseTimeToMills(timeStr string) int64 {
return 0
}
func LoadFileAsString(fileName string) (string, error) {
if f, err := os.Open(fileName); err == nil {
data, err1 := ioutil.ReadAll(bufio.NewReader(f))
return string(data), err1
} else {
return "", err
}
}
func GetSyncMapSize(m sync.Map) int {
var size int
m.Range(func(key, value interface{}) bool {