gotosocial/vendor/github.com/uptrace/bun/driver/pgdriver/unsafe.go
2021-08-23 16:54:26 +02:00

19 lines
290 B
Go

// +build !appengine
package pgdriver
import "unsafe"
func bytesToString(b []byte) string {
return *(*string)(unsafe.Pointer(&b))
}
//nolint:deadcode,unused
func stringToBytes(s string) []byte {
return *(*[]byte)(unsafe.Pointer(
&struct {
string
Cap int
}{s, len(s)},
))
}