Dawid Wysokiński
d1ba315bd2
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: #116
28 lines
443 B
Go
28 lines
443 B
Go
package domain
|
|
|
|
type NullString struct {
|
|
String string
|
|
Valid bool // Valid is true if String is not NULL
|
|
}
|
|
|
|
type NullBool struct {
|
|
Bool bool
|
|
Valid bool // Valid is true if Bool is not NULL
|
|
}
|
|
|
|
func uniq[T comparable](sl []T) []T {
|
|
res := make([]T, 0, len(sl))
|
|
seen := make(map[T]struct{}, len(sl))
|
|
|
|
for _, it := range sl {
|
|
if _, ok := seen[it]; ok {
|
|
continue
|
|
}
|
|
|
|
seen[it] = struct{}{}
|
|
res = append(res, it)
|
|
}
|
|
|
|
return res
|
|
}
|