forked from mtusi2026/mtusi2026lab2
12 lines
365 B
Go
12 lines
365 B
Go
package dto
|
|
|
|
import "time"
|
|
|
|
// Timestamp preserves PostgreSQL microseconds and is readable by Python 3.9 clients.
|
|
// time.Time's variable-length fractional part is not supported by those clients.
|
|
type Timestamp time.Time
|
|
|
|
func (t Timestamp) MarshalJSON() ([]byte, error) {
|
|
return []byte(`"` + time.Time(t).UTC().Format("2006-01-02T15:04:05.000000Z") + `"`), nil
|
|
}
|