Documentation
¶
Overview ¶
Package pgtime provides a wrapper around the raw Postgres 'timestamp with time zone' that comes back from the API, providing JSON marshalling and unmarshalling
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PgTime ¶
PgTime can be used just like time.Time. When used in JSON unmarshalling, it parses the field into a standard time.Time structure. If the value in the JSON is null, this is set to the zero value of time.Time{}. When marshalled, the JSON value will be an epoch integer timestamp, set in the UTC timezone
func (*PgTime) MarshalJSON ¶
MarshalJSON translates the time struct into a string, specifically an epoch integer timestamp set in the UTC timezone. If the time is a zero value, the strign "null" is used instead
func (*PgTime) UnmarshalJSON ¶
UnmarshalJSON parses the incoming string value into something useful. In the case of null or error, the zero value of time.Time{} is used