Value implements the driver.Valuer interface.
()
| 40 | |
| 41 | // Value implements the driver.Valuer interface. |
| 42 | func (j JSON) Value() (driver.Value, error) { |
| 43 | if len(j) == 0 { |
| 44 | return nil, nil |
| 45 | } |
| 46 | return json.RawMessage(j).MarshalJSON() |
| 47 | } |
| 48 | |
| 49 | // MarshalJSON implements the json.Marshaler interface. |
| 50 | func (j JSON) MarshalJSON() ([]byte, error) { |