github.com/redis/go-redis/v9/internal/util
No package summary is available.
Package
Files: 2. Third party imports: 0. Imports from organisation: 0. Tests: 0. Benchmarks: 0.
Functions
func Atoi
func Atoi(b []byte) (int, error) {
return strconv.Atoi(BytesToString(b))
}
Cognitive complexity: 0
, Cyclomatic complexity: 1
func BytesToString
BytesToString converts byte slice to string.
func BytesToString(b []byte) string {
return *(*string)(unsafe.Pointer(&b))
}
Cognitive complexity: 0
, Cyclomatic complexity: 1
func ParseFloat
func ParseFloat(b []byte, bitSize int) (float64, error) {
return strconv.ParseFloat(BytesToString(b), bitSize)
}
Cognitive complexity: 0
, Cyclomatic complexity: 1
func ParseInt
func ParseInt(b []byte, base int, bitSize int) (int64, error) {
return strconv.ParseInt(BytesToString(b), base, bitSize)
}
Cognitive complexity: 0
, Cyclomatic complexity: 1
func ParseUint
func ParseUint(b []byte, base int, bitSize int) (uint64, error) {
return strconv.ParseUint(BytesToString(b), base, bitSize)
}
Cognitive complexity: 0
, Cyclomatic complexity: 1
func StringToBytes
StringToBytes converts string to byte slice.
func StringToBytes(s string) []byte {
return *(*[]byte)(unsafe.Pointer(
&struct {
string
Cap int
}{s, len(s)},
))
}
Cognitive complexity: 2
, Cyclomatic complexity: 1
func ToPtr
func ToPtr[T any](v T) *T {
return &v
}
Cognitive complexity: 0
, Cyclomatic complexity: 1