adapt Timestamp/DateTime milisecond for MySQL/Postgres
This commit is contained in:
parent
8f8195a86b
commit
bc4c9cfa3b
|
@ -18,8 +18,13 @@ func FormatTime(dialect Dialect, sqlTypeName string, t time.Time) (v interface{}
|
||||||
v = s[11:19]
|
v = s[11:19]
|
||||||
case schemas.Date:
|
case schemas.Date:
|
||||||
v = t.Format("2006-01-02")
|
v = t.Format("2006-01-02")
|
||||||
case schemas.DateTime, schemas.TimeStamp, schemas.Varchar: // !DarthPestilane! format time when sqlTypeName is schemas.Varchar.
|
case schemas.Varchar: // !DarthPestilane! format time when sqlTypeName is schemas.Varchar.
|
||||||
if dialect.URI().DBType == schemas.ORACLE {
|
v = t.Format("2006-01-02 15:04:05")
|
||||||
|
case schemas.TimeStamp, schemas.DateTime:
|
||||||
|
dbType := dialect.URI().DBType
|
||||||
|
if dbType == schemas.POSTGRES || dbType == schemas.MYSQL {
|
||||||
|
v = t.Format("2006-01-02 15:04:05.999999")
|
||||||
|
} else if dialect.URI().DBType == schemas.ORACLE {
|
||||||
v = t
|
v = t
|
||||||
} else {
|
} else {
|
||||||
v = t.Format("2006-01-02 15:04:05")
|
v = t.Format("2006-01-02 15:04:05")
|
||||||
|
|
Loading…
Reference in New Issue