vikunja-api/vendor/github.com/go-redis/redis/internal/util.go
renovate 026d3dc80d Update module go-redis/redis to v6.15.7 (#234)
Update module go-redis/redis to v6.15.7

Reviewed-on: https://kolaente.dev/vikunja/api/pulls/234
2020-04-07 12:31:33 +00:00

39 lines
554 B
Go

package internal
import "github.com/go-redis/redis/internal/util"
func ToLower(s string) string {
if isLower(s) {
return s
}
b := make([]byte, len(s))
for i := range b {
c := s[i]
if c >= 'A' && c <= 'Z' {
c += 'a' - 'A'
}
b[i] = c
}
return util.BytesToString(b)
}
func isLower(s string) bool {
for i := 0; i < len(s); i++ {
c := s[i]
if c >= 'A' && c <= 'Z' {
return false
}
}
return true
}
func Unwrap(err error) error {
u, ok := err.(interface {
Unwrap() error
})
if !ok {
return nil
}
return u.Unwrap()
}