refactor: split dbx package into domain files
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>
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user