f9befa1b0a
Reorganize monolithic dbx.go and utility.go into focused files by concern, add package doc.go, and gitignore coverage.out. Co-authored-by: Cursor <cursoragent@cursor.com>
14 lines
353 B
Go
14 lines
353 B
Go
package dbx
|
|
|
|
import "strings"
|
|
|
|
// StringToFilter processes a string to be used as a filter in an SQL LIKE
|
|
// statement. It replaces all spaces with % and adds % to the beginning and
|
|
// end of the string.
|
|
func StringToFilter(str string) string {
|
|
str = strings.Trim(str, "%")
|
|
str = strings.ReplaceAll(str, " ", "%")
|
|
str = "%" + str + "%"
|
|
return str
|
|
}
|