Middlewares

This commit is contained in:
cdricms
2025-01-16 14:12:32 +01:00
parent 9a6e4a7565
commit 9bbd992e95
10 changed files with 238 additions and 39 deletions

11
backend/utils/contains.go Normal file
View File

@@ -0,0 +1,11 @@
package utils
func Contains[T comparable](arr []T, el T) bool {
for _, a := range arr {
if a == el {
return true
}
}
return false
}

9
backend/utils/map.go Normal file
View File

@@ -0,0 +1,9 @@
package utils
func Map[T any, U any](input []T, fn func(T) U) []U {
var result []U
for _, v := range input {
result = append(result, fn(v))
}
return result
}