mirror of
https://github.com/cloudreve/cloudreve.git
synced 2025-11-02 03:17:56 +08:00
Feat: delete objects
This commit is contained in:
@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user