gotosocial/vendor/github.com/uptrace/bun/internal/unsafe.go
dependabot[bot] 2470c8d8a0
[chore]: Bump github.com/uptrace/bun from 1.2.1 to 1.2.5
Bumps [github.com/uptrace/bun](https://github.com/uptrace/bun) from 1.2.1 to 1.2.5.
- [Release notes](https://github.com/uptrace/bun/releases)
- [Changelog](https://github.com/uptrace/bun/blob/master/CHANGELOG.md)
- [Commits](https://github.com/uptrace/bun/compare/v1.2.1...v1.2.5)

---
updated-dependencies:
- dependency-name: github.com/uptrace/bun
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-28 06:20:07 +00:00

22 lines
382 B
Go

//go:build !appengine
// +build !appengine
package internal
import "unsafe"
// String converts byte slice to string.
func String(b []byte) string {
if len(b) == 0 {
return ""
}
return unsafe.String(&b[0], len(b))
}
// Bytes converts string to byte slice.
func Bytes(s string) []byte {
if s == "" {
return []byte{}
}
return unsafe.Slice(unsafe.StringData(s), len(s))
}