Skip to content

Commit 9faabe5

Browse files
committed
Don't write microseconds when Time.Nanosecond() == 0
1 parent dd7b87c commit 9faabe5

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

connection.go

+3
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,9 @@ func (mc *mysqlConn) interpolateParams(query string, args []driver.Value) (strin
208208
parts[pos] = "'0000-00-00'"
209209
} else {
210210
fmt := "'2006-01-02 15:04:05.999999'"
211+
if v.Nanosecond() == 0 {
212+
fmt = "'2006-01-02 15:04:05'"
213+
}
211214
parts[pos] = v.In(mc.cfg.loc).Format(fmt)
212215
}
213216
case []byte:

0 commit comments

Comments
 (0)