Skip to main content

x

成员函数函数描述/介绍
x.AllAll returns true if all elements of the iterable are not empty (or if the iterable is empty)
x.AnyAny returns true if any element of the iterable is not empty. If the iterable is empty, return False.
x.ChunkChunk creates an array of elements split into groups with the length of size. If array can't be split evenly, the final chunk will be the remaining el...
x.ContainsContains returns true if an element is present in a iteratee.
x.ConvertToMap
x.DifferenceDifference returns the difference between two collections.
x.DropDrop creates an array/slice with n elements dropped from the beginning.
x.EqualIsEqual returns if the two objects are equal
x.EveryEvery returns true if every element is present in a iteratee.
x.Filter
x.Find
x.Foreach
x.ForeachRight
x.HeadHead gets the first element of array.
x.If
x.IndexOfIndexOf gets the index at which the first occurrence of value is found in array or return -1 if the value cannot be found
x.Intersect
x.IsSubsetSubset returns true if collection x is a subset of y.
x.KeysKeys creates an array of the own enumerable map keys or struct field names.
x.Map
x.Max
x.Min
x.Range
x.Reduce
x.RemoveRepeatUniq creates an array with unique values.
x.ReverseReverse transforms an array the first element will become the last, the second element will become the second to last, etc.
x.Shift
x.ShuffleShuffle creates an array of shuffled values
x.SomeSome returns true if atleast one element is present in an iteratee.
x.SortSliceStable sorts the slice x using the provided less function, keeping equal elements in their original order. It panics if x is not a slice. The le...
x.SubtractSubtract returns the subtraction between two collections.
x.SumSum computes the sum of the values in array.
x.TailTail gets all but the first element of array.
x.ToFloat64ToFloat64 converts any numeric value to float64.
x.ToMapToMap transforms a slice of instances to a Map. []Foo => Map<int, Foo>
x.ValuesValues creates an array of the own enumerable map values or struct field values.
x.WaitConnectWaitConnect 等待一个地址的端口开放或指导超时时间,如果超时则返回错误,这通常用于等待并确保一个服务启动
x.ZipZip returns a list of tuples, where the i-th tuple contains the i-th element from each of the input iterables. The returned list is truncated in lengt...

函数定义#

All#

详细描述#

All returns true if all elements of the iterable are not empty (or if the iterable is empty)

定义#

All(objs ...any) bool

参数#

参数名参数类型参数解释
objs...any

返回值#

返回值(顺序)返回值类型返回值解释
r1bool

Any#

详细描述#

Any returns true if any element of the iterable is not empty. If the iterable is empty, return False.

定义#

Any(objs ...any) bool

参数#

参数名参数类型参数解释
objs...any

返回值#

返回值(顺序)返回值类型返回值解释
r1bool

Chunk#

详细描述#

Chunk creates an array of elements split into groups with the length of size. If array can't be split evenly, the final chunk will be the remaining element.

定义#

Chunk(arr any, size int) any

参数#

参数名参数类型参数解释
arrany
sizeint

返回值#

返回值(顺序)返回值类型返回值解释
r1any

Contains#

详细描述#

Contains returns true if an element is present in a iteratee.

定义#

Contains(in any, elem any) bool

参数#

参数名参数类型参数解释
inany
elemany

返回值#

返回值(顺序)返回值类型返回值解释
r1bool

ConvertToMap#

详细描述#

定义#

ConvertToMap(i any) map[string][]string

参数#

参数名参数类型参数解释
iany

返回值#

返回值(顺序)返回值类型返回值解释
r1map[string][]string

Difference#

详细描述#

Difference returns the difference between two collections.

定义#

Difference(x any, y any) (any, any)

参数#

参数名参数类型参数解释
xany
yany

返回值#

返回值(顺序)返回值类型返回值解释
r1any
r2any

Drop#

详细描述#

Drop creates an array/slice with n elements dropped from the beginning.

定义#

Drop(in any, n int) any

参数#

参数名参数类型参数解释
inany
nint

返回值#

返回值(顺序)返回值类型返回值解释
r1any

Equal#

详细描述#

IsEqual returns if the two objects are equal

定义#

Equal(expected any, actual any) bool

参数#

参数名参数类型参数解释
expectedany
actualany

返回值#

返回值(顺序)返回值类型返回值解释
r1bool

Every#

详细描述#

Every returns true if every element is present in a iteratee.

定义#

Every(in any, elements ...any) bool

参数#

参数名参数类型参数解释
inany
elements...any

返回值#

返回值(顺序)返回值类型返回值解释
r1bool

Filter#

详细描述#

定义#

Filter(i any, fc func(any) bool) any

参数#

参数名参数类型参数解释
iany
fcfunc(any) bool

返回值#

返回值(顺序)返回值类型返回值解释
r1any

Find#

详细描述#

定义#

Find(i any, fc func(any) bool) any

参数#

参数名参数类型参数解释
iany
fcfunc(any) bool

返回值#

返回值(顺序)返回值类型返回值解释
r1any

Foreach#

详细描述#

定义#

Foreach(i any, fc func(any))

参数#

参数名参数类型参数解释
iany
fcfunc(any)

ForeachRight#

详细描述#

定义#

ForeachRight(i any, fc func(any))

参数#

参数名参数类型参数解释
iany
fcfunc(any)

Head#

详细描述#

Head gets the first element of array.

定义#

Head(arr any) any

参数#

参数名参数类型参数解释
arrany

返回值#

返回值(顺序)返回值类型返回值解释
r1any

If#

详细描述#

定义#

If(i bool, a any, b any) any

参数#

参数名参数类型参数解释
ibool
aany
bany

返回值#

返回值(顺序)返回值类型返回值解释
r1any

IndexOf#

详细描述#

IndexOf gets the index at which the first occurrence of value is found in array or return -1 if the value cannot be found

定义#

IndexOf(in any, elem any) int

参数#

参数名参数类型参数解释
inany
elemany

返回值#

返回值(顺序)返回值类型返回值解释
r1int

Intersect#

详细描述#

定义#

Intersect(x any, y any) any

参数#

参数名参数类型参数解释
xany
yany

返回值#

返回值(顺序)返回值类型返回值解释
r1any

IsSubset#

详细描述#

Subset returns true if collection x is a subset of y.

定义#

IsSubset(x any, y any) bool

参数#

参数名参数类型参数解释
xany
yany

返回值#

返回值(顺序)返回值类型返回值解释
r1bool

Keys#

详细描述#

Keys creates an array of the own enumerable map keys or struct field names.

定义#

Keys(out any) any

参数#

参数名参数类型参数解释
outany

返回值#

返回值(顺序)返回值类型返回值解释
r1any

Map#

详细描述#

定义#

Map(i any, fc funkGeneralFuncType) any

参数#

参数名参数类型参数解释
iany
fcfunkGeneralFuncType

返回值#

返回值(顺序)返回值类型返回值解释
r1any

Max#

详细描述#

定义#

Max(i any) any

参数#

参数名参数类型参数解释
iany

返回值#

返回值(顺序)返回值类型返回值解释
r1any

Min#

详细描述#

定义#

Min(i any) any

参数#

参数名参数类型参数解释
iany

返回值#

返回值(顺序)返回值类型返回值解释
r1any

Range#

详细描述#

定义#

Range(i int) []any

参数#

参数名参数类型参数解释
iint

返回值#

返回值(顺序)返回值类型返回值解释
r1[]any

Reduce#

详细描述#

定义#

Reduce(i any, fc funkGeneralReduceFuncType, acc any) any

参数#

参数名参数类型参数解释
iany
fcfunkGeneralReduceFuncType
accany

返回值#

返回值(顺序)返回值类型返回值解释
r1any

RemoveRepeat#

详细描述#

Uniq creates an array with unique values.

定义#

RemoveRepeat(in any) any

参数#

参数名参数类型参数解释
inany

返回值#

返回值(顺序)返回值类型返回值解释
r1any

Reverse#

详细描述#

Reverse transforms an array the first element will become the last, the second element will become the second to last, etc.

定义#

Reverse(in any) any

参数#

参数名参数类型参数解释
inany

返回值#

返回值(顺序)返回值类型返回值解释
r1any

Shift#

详细描述#

定义#

Shift(i any) any

参数#

参数名参数类型参数解释
iany

返回值#

返回值(顺序)返回值类型返回值解释
r1any

Shuffle#

详细描述#

Shuffle creates an array of shuffled values

定义#

Shuffle(in any) any

参数#

参数名参数类型参数解释
inany

返回值#

返回值(顺序)返回值类型返回值解释
r1any

Some#

详细描述#

Some returns true if atleast one element is present in an iteratee.

定义#

Some(in any, elements ...any) bool

参数#

参数名参数类型参数解释
inany
elements...any

返回值#

返回值(顺序)返回值类型返回值解释
r1bool

Sort#

详细描述#

SliceStable sorts the slice x using the provided less function, keeping equal elements in their original order. It panics if x is not a slice.

The less function must satisfy the same requirements as the Interface type's Less method.

定义#

Sort(x any, less func(i, j int) bool)

参数#

参数名参数类型参数解释
xany
lessfunc(i, j int) bool

Subtract#

详细描述#

Subtract returns the subtraction between two collections.

定义#

Subtract(x any, y any) any

参数#

参数名参数类型参数解释
xany
yany

返回值#

返回值(顺序)返回值类型返回值解释
r1any

Sum#

详细描述#

Sum computes the sum of the values in array.

定义#

Sum(arr any) float64

参数#

参数名参数类型参数解释
arrany

返回值#

返回值(顺序)返回值类型返回值解释
r1float64

Tail#

详细描述#

Tail gets all but the first element of array.

定义#

Tail(arr any) any

参数#

参数名参数类型参数解释
arrany

返回值#

返回值(顺序)返回值类型返回值解释
r1any

ToFloat64#

详细描述#

ToFloat64 converts any numeric value to float64.

定义#

ToFloat64(x any) (float64, bool)

参数#

参数名参数类型参数解释
xany

返回值#

返回值(顺序)返回值类型返回值解释
r1float64
r2bool

ToMap#

详细描述#

ToMap transforms a slice of instances to a Map. []Foo => Map<int, Foo>

定义#

ToMap(in any, pivot string) any

参数#

参数名参数类型参数解释
inany
pivotstring

返回值#

返回值(顺序)返回值类型返回值解释
r1any

Values#

详细描述#

Values creates an array of the own enumerable map values or struct field values.

定义#

Values(out any) any

参数#

参数名参数类型参数解释
outany

返回值#

返回值(顺序)返回值类型返回值解释
r1any

WaitConnect#

详细描述#

WaitConnect 等待一个地址的端口开放或指导超时时间,如果超时则返回错误,这通常用于等待并确保一个服务启动

Example:

timeout, _ = time.ParseDuration("1m")ctx, cancel = context.WithTimeout(context.New(), timeout)
    go func() {        err = tcp.Serve("127.0.0.1", 8888, tcp.serverCallback(func (conn) {        conn.Send("hello world")        conn.Close()    }), tcp.serverContext(ctx))
        die(err)    }()
os.WaitConnect("127.0.0.1:8888", 5)~ // 等待tcp服务器启动conn = tcp.Connect("127.0.0.1", 8888)~bytes = conn.Recv()~println(string(bytes))

定义#

WaitConnect(addr string, timeout float64) error

参数#

参数名参数类型参数解释
addrstring
timeoutfloat64

返回值#

返回值(顺序)返回值类型返回值解释
r1error

Zip#

详细描述#

Zip returns a list of tuples, where the i-th tuple contains the i-th element from each of the input iterables. The returned list is truncated in length to the length of the shortest input iterable.

定义#

Zip(slice1 any, slice2 any) []Tuple

参数#

参数名参数类型参数解释
slice1any
slice2any

返回值#

返回值(顺序)返回值类型返回值解释
r1[]Tuple