Documentation
¶
Index ¶
- Variables
- func Abbreviate(str string, length int) string
- func CloneBytes(src []byte) []byte
- func CloneBytesIf(src []byte, clone bool) []byte
- func EncodeUUIDHex(dst []byte, uuid []byte)
- func UnsafeBytesToString(b []byte) string
- func UnsafeFromBytes[T any](bs []byte) *T
- func UnsafePointer[P *T, T any](p P) unsafe.Pointer
- func UnsafeSizeOf[T any]() uintptr
- func UnsafeSlice[T any](ptr unsafe.Pointer, len int) []T
- func UnsafeSliceCast[B any, A any](from []A) []B
- func UnsafeSliceCastToLength[B any, A any](from []A, length int) []B
- func UnsafeSliceToBytes[T any](from []T) []byte
- func UnsafeStringToBytes(s string) []byte
- func UnsafeToBytes[P *T, T any](p P) []byte
- func UnsafeToBytesWithLength[P *T, T any](p P, length int) []byte
- func UnsafeUintptr[P *T, T any](p P) uintptr
Constants ¶
This section is empty.
Variables ¶
View Source
var Debug bool = false
View Source
var RaceDetectorEnabled bool = false
Functions ¶
func Abbreviate ¶
Abbreviate truncates a string from the beginning to the specified length. Parameters:
- str: the input string
- length: the maximum length to truncate to -1: return the complete string 0: return empty string >0: return the first 'length' characters, appending "..." if truncated
func CloneBytesIf ¶
CloneBytesIf conditionally copies a byte slice. If clone is true, it returns a new copy of the slice. If clone is false, it returns the original slice without copying. If the source slice is empty, it returns an empty slice.
func EncodeUUIDHex ¶ added in v1.0.0
EncodeUUIDHex encode uuid to string len(dst) >= 36, and uuid must be [16]byte
func UnsafeBytesToString ¶
func UnsafeFromBytes ¶
func UnsafePointer ¶
func UnsafeSizeOf ¶
func UnsafeSliceCast ¶
func UnsafeSliceCastToLength ¶
func UnsafeSliceToBytes ¶
func UnsafeStringToBytes ¶
func UnsafeToBytes ¶
func UnsafeToBytesWithLength ¶
Wrapper of unsafe.Slice
func UnsafeUintptr ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.