mirror of
https://github.com/hanzokv/go.git
synced 2026-09-24 00:31:51 +00:00
Update module path from github.com/redis/go-redis/v9 to github.com/hanzoai/kv-go/v9 for use as the Hanzo KV Go SDK. - Update go.mod module declaration - Update all Go imports across 260 files - Update all submodule go.mod files (extra/*, example/*, internal/customvet)
31 lines
948 B
Go
31 lines
948 B
Go
package helper
|
|
|
|
import (
|
|
"github.com/hanzoai/kv-go/v9/internal/util"
|
|
"github.com/zeebo/xxh3"
|
|
)
|
|
|
|
func ParseFloat(s string) (float64, error) {
|
|
return util.ParseStringToFloat(s)
|
|
}
|
|
|
|
func MustParseFloat(s string) float64 {
|
|
return util.MustParseFloat(s)
|
|
}
|
|
|
|
// DigestBytes computes the xxh3 hash of the given byte slice.
|
|
// This produces the same hash as the Redis DIGEST command, allowing you to
|
|
// calculate digests client-side without making a Redis call.
|
|
// This is useful for optimistic locking with SetIFDEQ, SetIFDNE, and DelExArgs.
|
|
func DigestBytes(data []byte) uint64 {
|
|
return xxh3.Hash(data)
|
|
}
|
|
|
|
// DigestString computes the xxh3 hash of the given string.
|
|
// This produces the same hash as the Redis DIGEST command, allowing you to
|
|
// calculate digests client-side without making a Redis call.
|
|
// This is useful for optimistic locking with SetIFDEQ, SetIFDNE, and DelExArgs.
|
|
func DigestString(s string) uint64 {
|
|
return xxh3.HashString(s)
|
|
}
|