fix(insert_build): 修复在生成sql语句时,时间对象精度损失问题
This commit is contained in:
parent
ca03e37c18
commit
09770b07dc
@ -137,7 +137,7 @@ func formatRowValues(values ...any) string {
|
|||||||
}
|
}
|
||||||
case sql.NullTime:
|
case sql.NullTime:
|
||||||
if v.Valid {
|
if v.Valid {
|
||||||
formattedValues[i] = fmt.Sprintf("'%s'", v.Time.Format(time.RFC3339))
|
formattedValues[i] = fmt.Sprintf("'%s'", v.Time.Format(time.RFC3339Nano))
|
||||||
} else {
|
} else {
|
||||||
formattedValues[i] = "null"
|
formattedValues[i] = "null"
|
||||||
}
|
}
|
||||||
@ -148,7 +148,7 @@ func formatRowValues(values ...any) string {
|
|||||||
case nil:
|
case nil:
|
||||||
formattedValues[i] = "null"
|
formattedValues[i] = "null"
|
||||||
case time.Time:
|
case time.Time:
|
||||||
formattedValues[i] = fmt.Sprintf("'%s'", v.Format(time.RFC3339))
|
formattedValues[i] = fmt.Sprintf("'%s'", v.Format(time.RFC3339Nano))
|
||||||
default:
|
default:
|
||||||
if reflect.TypeOf(val).Kind() == reflect.Ptr && reflect.ValueOf(val).IsNil() {
|
if reflect.TypeOf(val).Kind() == reflect.Ptr && reflect.ValueOf(val).IsNil() {
|
||||||
formattedValues[i] = "null"
|
formattedValues[i] = "null"
|
||||||
|
Loading…
Reference in New Issue
Block a user