diff options
Diffstat (limited to 'vendor/github.com/uptrace/bun/extra/bunotel/unsafe.go')
| -rw-r--r-- | vendor/github.com/uptrace/bun/extra/bunotel/unsafe.go | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/vendor/github.com/uptrace/bun/extra/bunotel/unsafe.go b/vendor/github.com/uptrace/bun/extra/bunotel/unsafe.go new file mode 100644 index 000000000..23accd40e --- /dev/null +++ b/vendor/github.com/uptrace/bun/extra/bunotel/unsafe.go @@ -0,0 +1,18 @@ +// +build !appengine + +package bunotel + +import "unsafe" + +func bytesToString(b []byte) string { + return *(*string)(unsafe.Pointer(&b)) +} + +func stringToBytes(s string) []byte { + return *(*[]byte)(unsafe.Pointer( + &struct { + string + Cap int + }{s, len(s)}, + )) +} |
