// Value implements the database/sql/driver Valuer interface. It will return the
// value of j as a driver.Value; specifically a []byte. Before returning the
// value, this function will validate the contained JSON and return any parsing
// errors encountered.
Value implements the database/sql/driver Valuer interface. It will return the
value of j as a driver.Value; specifically a []byte. Before returning the
value, this function will validate the contained JSON and return any parsing
errors encountered.
// Value implements the database / sql / driver Valuer interface . It will return the // value of j as a driver . Value ; specifically a [] byte . Before returning the // value this function will validate the contained JSON and return any parsing // errors encountered .
func (j RawJSON) Value() (driver.Value, error) {
	if len(j) == 0 {
		return nil, fmt.Errorf("types.RawJSON: invalid JSON, an empty string cannot be unmarshaled")
	}
	var tmp RawJSON
	if err := json.Unmarshal(j, &tmp); err != nil {
		return nil, err
	}
	return []byte(j), nil
}
func ( j RawJSON ) Value ( ) ( driver . Value , error ) { if len ( j ) == 0 { return nil , fmt . Errorf ( " " ) } var tmp RawJSON if err := json . Unmarshal ( j , & tmp ) ; err != nil { return nil , err } return [ ] byte ( j ) , nil }
Value implements the database/sql/driver Valuer interface.
Value implements the database / sql / driver Valuer interface .
// An empty byte slice is not valid JSON. Return an error that's more // descriptive than the encoding/json message. // Unmarshal to look for errors, unmarshal into a RawJSON to keep // unnecessary allocations to a minimum. // NB. At the time of writing, what I _actually_ want to call is // json.checkValid, but that function is not exported. So.