(beforeState map[string]any, afterState map[string]any, currentState map[string]any, fields []string)
| 125 | } |
| 126 | |
| 127 | func compareRetainedUpdateState(beforeState map[string]any, afterState map[string]any, currentState map[string]any, fields []string) retainedStateComparison { |
| 128 | var out retainedStateComparison |
| 129 | for _, field := range fields { |
| 130 | afterValue, ok := afterState[field] |
| 131 | if !ok { |
| 132 | continue |
| 133 | } |
| 134 | beforeValue := beforeState[field] |
| 135 | if mutableStateEqual(field, beforeValue, afterValue) { |
| 136 | continue |
| 137 | } |
| 138 | out.Changed = append(out.Changed, field) |
| 139 | currentValue := currentState[field] |
| 140 | switch { |
| 141 | case mutableStateEqual(field, currentValue, afterValue): |
| 142 | out.Retained = append(out.Retained, field) |
| 143 | case mutableStateEqual(field, currentValue, beforeValue): |
| 144 | out.Reverted = append(out.Reverted, field) |
| 145 | default: |
| 146 | out.Replaced = append(out.Replaced, field) |
| 147 | } |
| 148 | } |
| 149 | return out |
| 150 | } |
| 151 | |
| 152 | func mutableTrackedFields(itemType string) []string { |
| 153 | switch itemType { |
no test coverage detected