// Scan implements the database/sql Scanner interface. It expects to receive a
// valid JSON value as a string or a []byte, or NULL as a nil from an SQL
// database. A zero-length string or []byte, or a nil will be considered NULL,
// and j will be nulled, otherwise the the value will be assigned to j. Scan
// will not validate the incoming JSON.
Scan implements the database/sql Scanner interface. It expects to receive a
valid JSON value as a string or a []byte, or NULL as a nil from an SQL
database. A zero-length string or []byte, or a nil will be considered NULL,
and j will be nulled, otherwise the the value will be assigned to j. Scan
will not validate the incoming JSON.
// Scan implements the database / sql Scanner interface . It expects to receive a // valid JSON value as a string or a [] byte or NULL as a nil from an SQL // database . A zero - length string or [] byte or a nil will be considered NULL // and j will be nulled otherwise the the value will be assigned to j . Scan // will not validate the incoming JSON .
func (j *RawJSON) Scan(src interface{}) error {
	if j == nil {
		return fmt.Errorf("null.RawJSON: Scan called on nil pointer")
	}
	switch x := src.(type) {
	case nil:
		j.JSON = nil
		j.Valid = false
		return nil
	case []byte:
		if len(x) == 0 {
			j.JSON = nil
			j.Valid = false
			return nil
		}
		j.JSON.Set(x)
		j.Valid = true
		return nil
	case string:
		if len(x) == 0 {
			j.JSON = nil
			j.Valid = false
			return nil
		}
		j.JSON.SetStr(x)
		j.Valid = true
		return nil
	default:
		return fmt.Errorf("null.RawJSON: cannot scan type %T (%v)", src, src)
	}
}
func ( j * RawJSON ) Scan ( src interface { } ) error { if j == nil { return fmt . Errorf ( " " ) } switch x := src . ( type ) { case nil : j . JSON = nil j . Valid = false return nil case [ ] byte : if len ( x ) == 0 { j . JSON = nil j . Valid = false return nil } j . JSON . Set ( x ) j . Valid = true return nil case string : if len ( x ) == 0 { j . JSON = nil j . Valid = false return nil } j . JSON . SetStr ( x ) j . Valid = true return nil default : return fmt . Errorf ( " " , src , src ) } }
Scan implements the database/sql Scanner interface.
Scan implements the database / sql Scanner interface .