gtsocial-umbx

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

unsafe.go (266B)


      1 // +build !appengine
      2 
      3 package pgdialect
      4 
      5 import "unsafe"
      6 
      7 func bytesToString(b []byte) string {
      8 	return *(*string)(unsafe.Pointer(&b))
      9 }
     10 
     11 func stringToBytes(s string) []byte {
     12 	return *(*[]byte)(unsafe.Pointer(
     13 		&struct {
     14 			string
     15 			Cap int
     16 		}{s, len(s)},
     17 	))
     18 }