dcbot/internal/domain/domain.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
}