Implement top shares page

This commit is contained in:
Pijus Kamandulis
2025-06-23 14:37:06 +03:00
parent 260d2ec24b
commit d801debaf6
10 changed files with 279 additions and 9 deletions

14
notlinq/notlinq.go Normal file
View File

@@ -0,0 +1,14 @@
package notlinq
func UniqueBy[T any, K comparable](items []T, keySelector func(T) K) []T {
seen := make(map[K]struct{})
result := make([]T, 0, len(items))
for _, item := range items {
key := keySelector(item)
if _, exists := seen[key]; !exists {
seen[key] = struct{}{}
result = append(result, item)
}
}
return result
}