mirror of https://github.com/go-gorm/gorm.git
Refactor format log for postgres
This commit is contained in:
parent
df6c3c9237
commit
adf9b80fb7
|
@ -73,7 +73,7 @@ var LogFormatter = func(values ...interface{}) (messages []interface{}) {
|
||||||
if numericPlaceHolderRegexp.MatchString(values[3].(string)) {
|
if numericPlaceHolderRegexp.MatchString(values[3].(string)) {
|
||||||
sql = values[3].(string)
|
sql = values[3].(string)
|
||||||
for index, value := range formattedValues {
|
for index, value := range formattedValues {
|
||||||
placeholder := fmt.Sprintf(`\$%d([^\d])`, index+1)
|
placeholder := fmt.Sprintf(`\$%d([^\d]|$)`, index+1)
|
||||||
sql = regexp.MustCompile(placeholder).ReplaceAllString(sql, value+"$1")
|
sql = regexp.MustCompile(placeholder).ReplaceAllString(sql, value+"$1")
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue