public

package module
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 6, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

用于slice 去重 及 检查元素是否存在于 slice 中 去重,支持 booleans, numbers, strings, pointers, channels, arrays of comparable types

t := Unique(s []T)

元素检查,支持 booleans, numbers, strings, pointers, channels, arrays of comparable types

in:= IsExists(s []T)
ok := in(a)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AtosSlice

func AtosSlice(a []any) []string

[]any{} 转 []string{}

func Difference

func Difference[T comparable](a, b []T) ([]T, []T)

取两个切片的差集

func GetStructKeys

func GetStructKeys(s any, tag string) ([]string, error)

根据标签取出结构体所有key

func Intersection

func Intersection[T comparable](a, b []T) []T

取两个切片的交集

func IsExists

func IsExists[T comparable](s []T) func(v T) bool

func StructToMap

func StructToMap(object interface{}, tagName string) (map[string]interface{}, error)

结构体转 map[string]interface{}

func Union

func Union[T comparable](a, b []T) []T

取两个切片的并集

func Unique

func Unique[T comparable](s []T) []T

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL