From cba82ffb7fa3169ae26c3f33233efca3d1c7f462 Mon Sep 17 00:00:00 2001 From: justinpolygon <123573436+justinpolygon@users.noreply.github.com> Date: Tue, 5 Dec 2023 08:19:04 -0800 Subject: [PATCH] Fix JSON Marshaling for Millis and Nanos Types (#368) --- rest/models/types.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rest/models/types.go b/rest/models/types.go index 21fc8d5a..c3044661 100644 --- a/rest/models/types.go +++ b/rest/models/types.go @@ -250,8 +250,8 @@ func (m *Millis) UnmarshalJSON(data []byte) error { return nil } -func (m *Millis) MarshalJSON() ([]byte, error) { - return json.Marshal(time.Time(*m).UnixMilli()) +func (m Millis) MarshalJSON() ([]byte, error) { + return json.Marshal(time.Time(m).UnixMilli()) } // Nanos represents a Unix time in nanoseconds since January 1, 1970 UTC. @@ -269,6 +269,6 @@ func (n *Nanos) UnmarshalJSON(data []byte) error { return nil } -func (n *Nanos) MarshalJSON() ([]byte, error) { - return json.Marshal(time.Time(*n).UnixNano()) +func (n Nanos) MarshalJSON() ([]byte, error) { + return json.Marshal(time.Time(n).UnixNano()) }