From e24f30a258da25c02dabd53485fd21c5b7bda318 Mon Sep 17 00:00:00 2001 From: 4color <4color@noreply.gitea.io> Date: Thu, 4 Mar 2021 19:25:00 +0800 Subject: [PATCH] fix oracle insert datetime --- dialects/time.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dialects/time.go b/dialects/time.go index b0394745..9a3c82a4 100644 --- a/dialects/time.go +++ b/dialects/time.go @@ -19,7 +19,11 @@ func FormatTime(dialect Dialect, sqlTypeName string, t time.Time) (v interface{} case schemas.Date: v = t.Format("2006-01-02") case schemas.DateTime, schemas.TimeStamp, schemas.Varchar: // !DarthPestilane! format time when sqlTypeName is schemas.Varchar. - v = t.Format("2006-01-02 15:04:05") + if dialect.URI().DBType == schemas.ORACLE { + v = t + } else { + v = t.Format("2006-01-02 15:04:05") + } case schemas.TimeStampz: if dialect.URI().DBType == schemas.MSSQL { v = t.Format("2006-01-02T15:04:05.9999999Z07:00")