PostgreSQL accepts microsecond for timestamp
This commit is contained in:
parent
34dc7f8791
commit
a18e06ff25
|
@ -18,8 +18,14 @@ 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.DateTime, schemas.Varchar: // !DarthPestilane! format time when sqlTypeName is schemas.Varchar.
|
||||||
v = t.Format("2006-01-02 15:04:05")
|
v = t.Format("2006-01-02 15:04:05")
|
||||||
|
case schemas.TimeStamp:
|
||||||
|
if dialect.URI().DBType == schemas.POSTGRES {
|
||||||
|
v = t.Format("2006-01-02T15:04:05.999999")
|
||||||
|
} else {
|
||||||
|
v = t.Format("2006-01-02 15:04:05")
|
||||||
|
}
|
||||||
case schemas.TimeStampz:
|
case schemas.TimeStampz:
|
||||||
if dialect.URI().DBType == schemas.MSSQL {
|
if dialect.URI().DBType == schemas.MSSQL {
|
||||||
v = t.Format("2006-01-02T15:04:05.9999999Z07:00")
|
v = t.Format("2006-01-02T15:04:05.9999999Z07:00")
|
||||||
|
|
Loading…
Reference in New Issue