Skip to content

Commit b0a38f6

Browse files
authored
Merge pull request #216 from ioito/hotfix/qx-format-time
fix: format time debug string
2 parents b018084 + 6cb3bb0 commit b0a38f6

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

debug.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,13 @@ func _sqlDebug(sqlstr string, variables []interface{}) string {
4141

4242
func SQLPrintf(sqlstr string, variables []interface{}) string {
4343
for _, v := range variables {
44-
switch v.(type) {
44+
switch vv := v.(type) {
4545
case bool, int, int8, int16, int32, int64, uint, uint8, uint16, uint32, uint64, float32, float64:
4646
sqlstr = strings.Replace(sqlstr, "?", fmt.Sprintf("%v", v), 1)
47-
case string, time.Time:
47+
case string:
4848
sqlstr = strings.Replace(sqlstr, "?", fmt.Sprintf("'%s'", v), 1)
49+
case time.Time:
50+
sqlstr = strings.Replace(sqlstr, "?", fmt.Sprintf("'%s'", vv.UTC().Format(time.DateTime)), 1)
4951
default:
5052
sqlstr = strings.Replace(sqlstr, "?", fmt.Sprintf("'%v'", v), 1)
5153
}

0 commit comments

Comments
 (0)