nullJSON returns nil for empty/zero JSON so it persists as SQL NULL.
(j json.RawMessage)
| 170 | |
| 171 | // nullJSON returns nil for empty/zero JSON so it persists as SQL NULL. |
| 172 | func nullJSON(j json.RawMessage) any { |
| 173 | if len(j) == 0 { |
| 174 | return nil |
| 175 | } |
| 176 | return []byte(j) |
| 177 | } |
| 178 | |
| 179 | func jsonOrNil(b []byte) json.RawMessage { |
| 180 | if len(b) == 0 { |
no outgoing calls
no test coverage detected