This commit is contained in:
Nurlygayanova Ekaterina
2026-11-05 17:56:30 +03:00
parent 0ab3a341aa
commit 1c95e2e68e
178 changed files with 21135 additions and 17 deletions
+22
View File
@@ -0,0 +1,22 @@
package db
import "strings"
var (
textEncoder = strings.NewReplacer(`\`, `\\`, "\x00", `\0`)
textDecoder = strings.NewReplacer(`\\`, `\`, `\0`, "\x00")
)
func encodeText(s string) string {
if !strings.ContainsAny(s, "\\\x00") {
return s
}
return textEncoder.Replace(s)
}
func decodeText(s string) string {
if !strings.Contains(s, `\`) {
return s
}
return textDecoder.Replace(s)
}