Feat: delete objects

This commit is contained in:
HFO4
2019-11-30 15:09:56 +08:00
parent 0cbbe5bb79
commit 93010e3525
26 changed files with 398 additions and 55 deletions

View File

@ -2,6 +2,7 @@ package util
import (
"math/rand"
"regexp"
"strings"
)
@ -43,3 +44,15 @@ func Replace(table map[string]string, s string) string {
}
return s
}
// BuildRegexp 构建用于SQL查询用的多条件正则
func BuildRegexp(search []string, prefix, suffix, condition string) string {
var res string
for key, value := range search {
res += prefix + regexp.QuoteMeta(value) + suffix
if key < len(search)-1 {
res += condition
}
}
return res
}