MarshalJSON marshals the NullUUID as null or the nested UUID
()
| 94 | |
| 95 | // MarshalJSON marshals the NullUUID as null or the nested UUID |
| 96 | func (u NullUUID) MarshalJSON() ([]byte, error) { |
| 97 | if !u.Valid { |
| 98 | return json.Marshal(nil) |
| 99 | } |
| 100 | |
| 101 | return json.Marshal(u.UUID) |
| 102 | } |
| 103 | |
| 104 | // UnmarshalJSON unmarshals a NullUUID |
| 105 | func (u *NullUUID) UnmarshalJSON(b []byte) error { |