2022-10-10 05:16:40 +00:00
|
|
|
package domain
|
|
|
|
|
|
|
|
type NullString struct {
|
|
|
|
String string
|
|
|
|
Valid bool // Valid is true if String is not NULL
|
|
|
|
}
|
2022-10-28 11:59:20 +00:00
|
|
|
|
|
|
|
type NullBool struct {
|
|
|
|
Bool bool
|
|
|
|
Valid bool // Valid is true if Bool is not NULL
|
|
|
|
}
|
2023-07-13 04:22:52 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
}
|