How can I check if the column has changed inside the struct array

Viewed 47

I'm using gorm as a Golang ORM. I need to detect is_active field has changed to trigger a update on a thirdy-party API service.

Here is my struct:

type MyProduct struct {
     ...
     MyVariants   []Variants

}

Variants type has IsActive column.I want to check IsActive column has changed or not of the all elements of the MyVariants array. I want to do this in BeforeUpdate or AfterUpdate Hooks.

0 Answers
Related