Skip to content

Commit

Permalink
removed some complexity from data service
Browse files Browse the repository at this point in the history
  • Loading branch information
tomvodi committed Aug 31, 2024
1 parent 30a94e3 commit 980ba7c
Show file tree
Hide file tree
Showing 3 changed files with 374 additions and 156 deletions.
12 changes: 12 additions & 0 deletions internal/common/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,15 @@ func HashFromData(data []byte) (string, error) {

return fmt.Sprintf("%x", hash.Sum(nil)), nil
}

func RemoveDuplicates[T comparable](sliceList []T) []T {
allKeys := make(map[T]bool)
list := []T{}
for _, item := range sliceList {
if _, value := allKeys[item]; !value {
allKeys[item] = true
list = append(list, item)
}
}
return list
}
Loading

0 comments on commit 980ba7c

Please sign in to comment.