mergeIssueFieldValues returns a merged slice where incoming values override existing ones for the same field ID, and existing fields not present in incoming are preserved. Ordering is deterministic: incoming entries first in their original order, followed by any existing entries (in their original o
(existing, incoming []*github.IssueRequestFieldValue)
| 463 | // Ordering is deterministic: incoming entries first in their original order, followed by any |
| 464 | // existing entries (in their original order) whose field IDs weren't seen in incoming. |
| 465 | func mergeIssueFieldValues(existing, incoming []*github.IssueRequestFieldValue) []*github.IssueRequestFieldValue { |
| 466 | seen := make(map[int64]struct{}, len(incoming)) |
| 467 | result := make([]*github.IssueRequestFieldValue, 0, len(existing)+len(incoming)) |
| 468 | for _, v := range incoming { |
| 469 | seen[v.FieldID] = struct{}{} |
| 470 | result = append(result, v) |
| 471 | } |
| 472 | for _, v := range existing { |
| 473 | if _, ok := seen[v.FieldID]; ok { |
| 474 | continue |
| 475 | } |
| 476 | result = append(result, v) |
| 477 | } |
| 478 | return result |
| 479 | } |
| 480 | |
| 481 | // IssueFragment represents a fragment of an issue node in the GraphQL API. |
| 482 | type IssueFragment struct { |