Devendra174's picture
Upload folder using huggingface_hub
1e92f2d verified
raw
history blame contribute delete
409 Bytes
package search
import "strings"
// We need to escape any characters that have meaning for `ILIKE` in Postgres.
// https://www.postgresql.org/docs/8.3/static/functions-matching.html
var escapeRep = strings.NewReplacer(`\`, `\\`, `%`, `\%`, `_`, `\_`)
// Escape will escape a search string for use with the Postgres `like` and `ilike` operators.
func Escape(s string) string {
return escapeRep.Replace(s)
}