Go API Documentation

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

Uses: strconv.Atoi.

func BytesToString

BytesToString converts byte slice to string.

func BytesToString(b []byte) string {
	return *(*string)(unsafe.Pointer(&b))
}

Cognitive complexity: 0, Cyclomatic complexity: 1

Uses: unsafe.Pointer.

func ParseFloat

func ParseFloat(b []byte, bitSize int) (float64, error) {
	return strconv.ParseFloat(BytesToString(b), bitSize)
}

Cognitive complexity: 0, Cyclomatic complexity: 1

Uses: strconv.ParseFloat.

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

Uses: strconv.ParseInt.

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

Uses: strconv.ParseUint.

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

Uses: unsafe.Pointer.

func ToPtr

func ToPtr[T any](v T) *T {
	return &v
}

Cognitive complexity: 0, Cyclomatic complexity: 1