feat(db): Improve BuildCaseInsensitiveLike with lowercase (#36598)

Improve BuildCaseInsensitiveLike with lowercase, users are more likely
to input lowercase letters, so lowercase letters are used.

---------

Signed-off-by: Tyrone Yeh <siryeh@gmail.com>
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
Tyrone Yeh
2026-02-14 15:40:59 +08:00
committed by GitHub
parent ce61d6d99d
commit 7a8fe9eb37
4 changed files with 32 additions and 36 deletions
+4 -4
View File
@@ -90,12 +90,12 @@ func CryptoRandomBytes(length int64) ([]byte, error) {
return buf, err
}
// ToUpperASCII returns s with all ASCII letters mapped to their upper case.
func ToUpperASCII(s string) string {
// ToLowerASCII returns s with all ASCII letters mapped to their lower case.
func ToLowerASCII(s string) string {
b := []byte(s)
for i, c := range b {
if 'a' <= c && c <= 'z' {
b[i] -= 'a' - 'A'
if 'A' <= c && c <= 'Z' {
b[i] += 'a' - 'A'
}
}
return string(b)