utils

package
v0.0.0-...-27e9f93 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func All

func All(vs []string, f func(string) bool) bool

All 如果切片 `vs` 中的所有字符串都满足条件 `f`,则返回 `true`。

func Any

func Any(vs []string, f func(string) bool) bool

Any 如果切片 `vs` 中的任意一个字符串满足条件 `f`,则返回 `true`。

func Difference

func Difference(slice1, slice2 []string) []string

Difference 求差集,slice1-slice2

func Filter

func Filter(vs []string, f func(string) bool) []string

Filter 返回一个新的切片,新切片由原切片 `vs` 中满足条件 `f` 的字符串构成。

func Include

func Include(vs []string, t string) bool

Include 如果目标字符串 `t` 存在于切片 `vs` 中,则返回 `true`。

func Index

func Index(vs []string, t string) int

Index 返回目标字符串 `t` 在 `vs` 中第一次出现位置的索引, 或者在没有匹配值时返回 -1。

func Intersect

func Intersect(slice1, slice2 []string) []string

Intersect 求交集

func MD5File

func MD5File(f *multipart.FileHeader) (string, error)

MD5File 计算文件MD5

func MD5Pwd

func MD5Pwd(username string, password string) string

MD5Pwd 密码哈希函数

func Map

func Map(vs []string, f func(string) string) []string

Map 返回一个新的切片,新切片的字符串由原切片 `vs` 中的字符串经过函数 `f` 映射后得到。

func Union

func Union(slice1, slice2 []string) []string

Union 求并集

Types

type IFUniqueItem

type IFUniqueItem interface {
	GetUniqueIndex() string
}

IFUniqueItem 去重接口

func RemoveDuplicateElemt

func RemoveDuplicateElemt(items []IFUniqueItem) []IFUniqueItem

RemoveDuplicateElemt 去重函数

Jump to

Keyboard shortcuts

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