1
This commit is contained in:
parent
763b161e26
commit
8877d9e02a
12
strutils.go
12
strutils.go
@ -140,3 +140,15 @@ func AdjustRangeValue[T int | int32 | int64 | float32 | float64](value T, minV T
|
|||||||
func IsWeb3ZeroAddress(address string) bool {
|
func IsWeb3ZeroAddress(address string) bool {
|
||||||
return address == "0x0000000000000000000000000000000000000000"
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
10
sysutils.go
10
sysutils.go
@ -12,6 +12,7 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"runtime"
|
"runtime"
|
||||||
"hash/crc32"
|
"hash/crc32"
|
||||||
|
"bufio"
|
||||||
)
|
)
|
||||||
|
|
||||||
func GetDaySeconds(seconds int64, timeZone int64) int64 {
|
func GetDaySeconds(seconds int64, timeZone int64) int64 {
|
||||||
@ -298,6 +299,15 @@ func SmartParseTimeToMills(timeStr string) int64 {
|
|||||||
return 0
|
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 {
|
func GetSyncMapSize(m sync.Map) int {
|
||||||
var size int
|
var size int
|
||||||
m.Range(func(key, value interface{}) bool {
|
m.Range(func(key, value interface{}) bool {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user