Last active
October 22, 2019 09:04
-
-
Save anta40/10aff56a7414d438b7cffe59203467aa to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type NullTime struct { | |
sql.NullString | |
} | |
func (nt *NullTime) MarshalJSON() ([]byte, error) { | |
if !nt.NullString.Valid { | |
return []byte("null"), nil | |
} | |
t, _ := time.Parse(time.RFC3339, nt.String) | |
return json.Marshal(t.Format("15:04:05")) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment