Documentation ¶
Index ¶
- Constants
- Variables
- func Bytes2String(b []byte) string
- func ChanIsClosed(ch any) bool
- func CheckFilepath(filename string, notExistToCreate ...bool) error
- func CloseQuietly(closer io.Closer)
- func Convert(data []string, v interface{}) error
- func Copy(toValue interface{}, fromValue interface{}) (err error)
- func CopyWithOption(toValue interface{}, fromValue interface{}, opt Option) (err error)
- func EndsWith(str string, suffixes []string) bool
- func Filter[S ~[]E, E any](slice S, condition func(E) bool) S
- func Float64s(a *[]float64)
- func Float64sAreUnique(a []float64) bool
- func Ints(a *[]int)
- func IntsAreUnique(a []int) bool
- func IsEmpty(s string) bool
- func IsUniqued(data sort.Interface) bool
- func KebabCase(s string) string
- func LowerCamelCase(s string) string
- func ParseFloat(s string) float64
- func ParseInt(s string) int64
- func ParseUint(s string) uint64
- func Reverse[S ~[]E, E any](s S) S
- func SnakeCase(s string) string
- func Sort(data Interface)
- func StartsWith(str string, prefixes []string) bool
- func String2Bytes(s string) []byte
- func Strings(a *[]string)
- func StringsAreUnique(a []string) bool
- func ToCamelCase(kebab string) (camelCase string)
- func ToFront(data sort.Interface) (n int)
- func ToString(value interface{}) string
- func Unique(data Interface)
- func UpperCamelCase(s string) string
- func UpperKebabCase(s string) string
- func UpperSnakeCase(s string) string
- type Float64Slice
- type IntSlice
- type Interface
- type Option
- type StringSlice
Constants ¶
const ( // CACHE_DIR_MODE 目录权限 CACHE_DIR_MODE os.FileMode = 0755 // CACHE_FILE_MODE 文件权限 CACHE_FILE_MODE os.FileMode = 0644 // DEBUG 调试开关 DEBUG = false // CACHE_REPLACE 文件替换模式, 会用到os.TRUNC CACHE_REPLACE = os.O_CREATE | os.O_RDWR | os.O_TRUNC // CACHE_UPDATE 更新 CACHE_UPDATE = os.O_CREATE | os.O_WRONLY )
const (
IGNORE_FLOAT = true
)
Variables ¶
Functions ¶
func Copy ¶ added in v1.1.9
func Copy(toValue interface{}, fromValue interface{}) (err error)
Copy copy things
func CopyWithOption ¶ added in v1.1.9
CopyWithOption copy with option
func Float64s ¶ added in v1.3.26
func Float64s(a *[]float64)
Float64s removes duplicate elements from a sorted slice of float64s.
func Float64sAreUnique ¶ added in v1.3.26
Float64sAreUnique tests whether a slice of float64s is sorted and its elements are unique.
func Ints ¶ added in v1.3.26
func Ints(a *[]int)
Ints removes duplicate elements from a sorted slice of ints.
func IntsAreUnique ¶ added in v1.3.26
IntsAreUnique tests whether a slice of ints is sorted and its elements are unique.
func IsUniqued ¶ added in v1.3.26
IsUniqued reports whether the elements in data are sorted and unique.
func LowerCamelCase ¶ added in v1.1.21
LowerCamelCase converts a string into camel case starting with a lower case letter.
func ParseFloat ¶
func Sort ¶ added in v1.3.26
func Sort(data Interface)
Sort sorts and removes duplicate entries from data.
func StartsWith ¶ added in v1.3.4
StartsWith 字符串前缀判断
func Strings ¶ added in v1.3.26
func Strings(a *[]string)
Strings removes duplicate elements from a sorted slice of strings.
func StringsAreUnique ¶ added in v1.3.26
StringsAreUnique tests whether a slice of strings is sorted and its elements are unique.
func ToCamelCase ¶ added in v1.1.21
ToCamelCase 转驼峰
func ToFront ¶ added in v1.3.26
ToFront reports the number of unique elements of data which it moves to the first n positions. It assumes sort.IsSorted(data).
func Unique ¶ added in v1.3.26
func Unique(data Interface)
Unique removes duplicate elements from data. It assumes sort.IsSorted(data).
func UpperCamelCase ¶ added in v1.1.21
UpperCamelCase converts a string into camel case starting with a upper case letter.
func UpperKebabCase ¶ added in v1.1.21
UpperKebabCase converts a string into kebab case with capital letters.
func UpperSnakeCase ¶ added in v1.1.21
UpperSnakeCase converts a string into snake case with capital letters.
Types ¶
type Float64Slice ¶ added in v1.3.26
type Float64Slice struct{ P *[]float64 }
Float64Slice attaches the methods of Interface to []float64.
func (Float64Slice) Len ¶ added in v1.3.26
func (p Float64Slice) Len() int
func (Float64Slice) Less ¶ added in v1.3.26
func (p Float64Slice) Less(i, j int) bool
func (Float64Slice) Swap ¶ added in v1.3.26
func (p Float64Slice) Swap(i, j int)
func (Float64Slice) Truncate ¶ added in v1.3.26
func (p Float64Slice) Truncate(n int)
type IntSlice ¶ added in v1.3.26
type IntSlice struct{ P *[]int }
IntSlice attaches the methods of Interface to []int.
type Interface ¶ added in v1.3.26
type Interface interface { sort.Interface // Truncate reduces the length to the first n elements. Truncate(n int) }
Interface Types that implement unique.Interface can have duplicate elements removed by the functionality in this package.
type Option ¶ added in v1.1.9
type Option struct { // setting this value to true will ignore copying zero values of all the fields, including bools, as well as a // struct having all it's fields set to their zero values respectively (see IsZero() in reflect/value.go) IgnoreEmpty bool DeepCopy bool }
Option sets copy options
type StringSlice ¶ added in v1.3.26
type StringSlice struct{ P *[]string }
StringSlice attaches the methods of Interface to []string.
func (StringSlice) Len ¶ added in v1.3.26
func (p StringSlice) Len() int
func (StringSlice) Less ¶ added in v1.3.26
func (p StringSlice) Less(i, j int) bool
func (StringSlice) Swap ¶ added in v1.3.26
func (p StringSlice) Swap(i, j int)
func (StringSlice) Truncate ¶ added in v1.3.26
func (p StringSlice) Truncate(n int)