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