ilk
This commit is contained in:
24
svc/internal/authz/mssql_helpers.go
Normal file
24
svc/internal/authz/mssql_helpers.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package authz
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func BuildINClause(column string, codes []string) string {
|
||||
if len(codes) == 0 {
|
||||
return "1=0"
|
||||
}
|
||||
var quoted []string
|
||||
for _, c := range codes {
|
||||
c = strings.TrimSpace(strings.ToUpper(c))
|
||||
if c == "" {
|
||||
continue
|
||||
}
|
||||
quoted = append(quoted, "'"+c+"'")
|
||||
}
|
||||
if len(quoted) == 0 {
|
||||
return "1=0"
|
||||
}
|
||||
return fmt.Sprintf("%s IN (%s)", column, strings.Join(quoted, ","))
|
||||
}
|
||||
Reference in New Issue
Block a user