package dto

func UniqueSlice(slice []string) []string {
	seen := make(map[string]struct{}) // 使用空结构体节省内存
	result := []string{}

	for _, value := range slice {
		if _, ok := seen[value]; !ok {
			seen[value] = struct{}{}
			result = append(result, value)
		}
	}

	return result
}
func UniqueSliceInt(slice []int) []int {
	seen := make(map[int]struct{}) // 使用空结构体节省内存
	result := []int{}

	for _, value := range slice {
		if _, ok := seen[value]; !ok {
			seen[value] = struct{}{}
			result = append(result, value)
		}
	}

	return result
}
func RemoveValue(slice []string, value string) []string {
	result := []string{}
	for _, v := range slice {
		if v != value {
			result = append(result, v)
		}
	}
	return result
}
