lib/ur: Zero our the value before unmarshal (#6790)
* lib/ur: Zero our the value before unmarshal * Comment * Complete rewrite
This commit is contained in:
@@ -379,6 +379,10 @@ func (r Report) Value() (driver.Value, error) {
|
||||
}
|
||||
|
||||
func (r *Report) Scan(value interface{}) error {
|
||||
// Zero out the previous value
|
||||
// JSON un-marshaller does not touch fields that are not in the payload, so we carry over values from a previous
|
||||
// scan.
|
||||
*r = Report{}
|
||||
b, ok := value.([]byte)
|
||||
if !ok {
|
||||
return errors.New("type assertion to []byte failed")
|
||||
|
||||
Reference in New Issue
Block a user