Documentation
¶
Index ¶
- func Back[T any](srcs []T) (T, []T)
- func Chunk[T any](srcs []T, size int) [][]T
- func Contains[T comparable](srcs []T, e T) bool
- func ContainsFunc[T any](srcs []T, fn func(src T) bool) bool
- func Delete[T any](srcs []T, i int) []T
- func Excludes[T comparable](base []T, target []T) []T
- func Filter[T any](srcs []T, fn func(src T) bool) []T
- func Insert[T any](srcs []T, v T, i int) []T
- func Map[T, E any](srcs []T, fn func(src T) E) []E
- func Reduce[T, E any](srcs []T, fn func(dst E, src T) E) E
- func Shift[T any](srcs []T) (T, []T)
- func Shuffle[T any](srcs []T) []T
- func Uniq[T comparable](srcs []T) []T
- type Stream
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContainsFunc ¶ added in v1.5.0
func Excludes ¶
func Excludes[T comparable](base []T, target []T) []T
配列で指定したbaseの中でtargetに含まれない値の配列を取得
Types ¶
type Stream ¶
type Stream struct {
// contains filtered or unexported fields
}
func (*Stream) Contains ¶
dst := StreamOf(hoges).
Contains(func(hoge *Hoge) bool {
return hoge.ID == "abc"
})
要素の存在確認
func (*Stream) Filter ¶
dst := StreamOf(hoges).
Filter(func(hoge *Hoge) bool {
return hoge.Num > 3
}).Out().([]*Hoge)
要素のフィルタリング
func (*Stream) ForEach ¶
dst := StreamOf(hoges).
ForEach(func(hoge *Hoge, i int) {
hoge.ID = "abc"
})
要素のループ
func (*Stream) Map ¶
dst := StreamOf(hoges).
Map(func(hoge *Hoge) string {
return hoge.ID
}).Out().([]string)
要素の変換
Click to show internal directories.
Click to hide internal directories.