1
0
mirror of https://github.com/uptrace/go-clickhouse.git synced 2025-06-06 23:16:18 +02:00
2022-03-21 08:58:25 +02:00

23 lines
352 B
Go

//go:build !appengine
package internal
import (
"unsafe"
)
// BytesToString converts byte slice to string.
func String(b []byte) string {
return *(*string)(unsafe.Pointer(&b))
}
// StringToBytes converts string to byte slice.
func Bytes(s string) []byte {
return *(*[]byte)(unsafe.Pointer(
&struct {
string
Cap int
}{s, len(s)},
))
}