1
0
mirror of https://github.com/muety/wakapi.git synced 2023-08-10 21:12:56 +03:00

fix: attempt to directly hash struct again

This commit is contained in:
Ferdinand Mütsch
2021-01-31 18:29:50 +01:00
parent f483488dd5
commit b7ae15496d
2 changed files with 21 additions and 17 deletions

View File

@@ -71,6 +71,10 @@ func (j *CustomTime) Scan(value interface{}) error {
return nil
}
func (j *CustomTime) Hash() (uint64, error) {
return uint64((j.T().UnixNano() / 1000) / 1000), nil
}
func (j CustomTime) Value() (driver.Value, error) {
t := time.Unix(0, j.T().UnixNano()/int64(time.Millisecond)*int64(time.Millisecond)) // round to millisecond precision
return t, nil