This commit is contained in:
noMoon 2021-06-01 12:44:04 -04:00
parent a981e528c6
commit c80e794a6a

View File

@ -3,6 +3,7 @@ package logger
import ( import (
"database/sql/driver" "database/sql/driver"
"fmt" "fmt"
"log"
"reflect" "reflect"
"regexp" "regexp"
"strconv" "strconv"
@ -81,6 +82,7 @@ func ExplainSQL(sql string, numericPlaceholder *regexp.Regexp, escaper string, a
vars[idx] = strconv.FormatFloat(v.(float64), 'f', -1, 64) vars[idx] = strconv.FormatFloat(v.(float64), 'f', -1, 64)
case string: case string:
vars[idx] = escaper + strings.Replace(v, escaper, "\\"+escaper, -1) + escaper vars[idx] = escaper + strings.Replace(v, escaper, "\\"+escaper, -1) + escaper
log.Println("hoho", vars[idx])
default: default:
rv := reflect.ValueOf(v) rv := reflect.ValueOf(v)
if v == nil || !rv.IsValid() || rv.Kind() == reflect.Ptr && rv.IsNil() { if v == nil || !rv.IsValid() || rv.Kind() == reflect.Ptr && rv.IsNil() {