gotosocial/vendor/github.com/uptrace/bun/extra/bunotel/unsafe.go

21 lines
315 B
Go
Raw Normal View History

//go:build !appengine
2023-05-09 17:19:48 +00:00
// +build !appengine
package bunotel
import "unsafe"
func bytesToString(b []byte) string {
if len(b) == 0 {
return ""
}
return unsafe.String(&b[0], len(b))
2023-05-09 17:19:48 +00:00
}
func stringToBytes(s string) []byte {
if s == "" {
return []byte{}
}
return unsafe.Slice(unsafe.StringData(s), len(s))
2023-05-09 17:19:48 +00:00
}