mirror of
https://github.com/gogs/gogs.git
synced 2026-01-17 04:42:21 +01:00
Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
22 lines
441 B
Go
22 lines
441 B
Go
package dbutil
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"gogs.io/gogs/internal/conf"
|
|
)
|
|
|
|
// Quote adds surrounding double quotes for all given arguments before being
|
|
// formatted if the current database is UsePostgreSQL.
|
|
func Quote(format string, args ...string) string {
|
|
anys := make([]any, len(args))
|
|
for i := range args {
|
|
if conf.UsePostgreSQL {
|
|
anys[i] = `"` + args[i] + `"`
|
|
} else {
|
|
anys[i] = args[i]
|
|
}
|
|
}
|
|
return fmt.Sprintf(format, anys...)
|
|
}
|