Files
online-backend/internal/shared/query.go
GuwandykA d1a6fcaadc
Some checks failed
CI/CD / Vet, test, build (push) Has been cancelled
CI/CD / Docker image (push) Has been cancelled
CI/CD / Deploy binary to server (push) Has been cancelled
ch some
2026-09-04 19:33:26 +05:00

12 lines
314 B
Go

package shared
import "strings"
// LikePattern escapes SQL LIKE metacharacters and wraps term for a %term% match.
func LikePattern(term string) string {
term = strings.ReplaceAll(term, `\`, `\\`)
term = strings.ReplaceAll(term, `%`, `\%`)
term = strings.ReplaceAll(term, `_`, `\_`)
return "%" + term + "%"
}