@@ -562,6 +562,21 @@ func isNotNull(v interface{}) bool {
562
562
// these methods remain unimplemented in the FakeQuerier.
563
563
var ErrUnimplemented = xerrors .New ("unimplemented" )
564
564
565
+ func uniqueSortedUUIDs (uuids []uuid.UUID ) []uuid.UUID {
566
+ set := make (map [uuid.UUID ]struct {})
567
+ for _ , id := range uuids {
568
+ set [id ] = struct {}{}
569
+ }
570
+ unique := make ([]uuid.UUID , 0 , len (set ))
571
+ for id := range set {
572
+ unique = append (unique , id )
573
+ }
574
+ slices .SortFunc (unique , func (a , b uuid.UUID ) bool {
575
+ return a .String () < b .String ()
576
+ })
577
+ return unique
578
+ }
579
+
565
580
func (* FakeQuerier ) AcquireLock (_ context.Context , _ int64 ) error {
566
581
return xerrors .New ("AcquireLock must only be called within a transaction" )
567
582
}
@@ -2147,7 +2162,7 @@ func (q *FakeQuerier) GetTemplateParameterInsights(ctx context.Context, arg data
2147
2162
for value , count := range counts [key ] {
2148
2163
rows = append (rows , database.GetTemplateParameterInsightsRow {
2149
2164
Num : utp .Num ,
2150
- TemplateIDs : utp .TemplateIDs ,
2165
+ TemplateIDs : uniqueSortedUUIDs ( utp .TemplateIDs ) ,
2151
2166
Name : utp .Name ,
2152
2167
DisplayName : utp .DisplayName ,
2153
2168
Description : utp .Description ,
0 commit comments