Documentation ¶
Index ¶
- Variables
- func HandleError(err *error)
- type Option
- func (o *Option) And(other *Option) *Option
- func (o *Option) AndThen(function interface{}) *Option
- func (o *Option) Bind(function interface{}) *Option
- func (o *Option) Else(other *Option) *Option
- func (o *Option) Filter(fn interface{}) *Option
- func (o *Option) Get() interface{}
- func (o *Option) IfPresent(fn func(interface{}))
- func (o *Option) IsNil() bool
- func (o *Option) IsPresent() bool
- func (o *Option) Map(mapFunc interface{}) *Option
- type PipelineStream
- func (s *PipelineStream) AllMatch(fn interface{}) bool
- func (s *PipelineStream) AnyMatch(fn interface{}) bool
- func (s *PipelineStream) Collect(collector interface{}) interface{}
- func (s *PipelineStream) Count() int
- func (s *PipelineStream) Distinct(fn interface{}) Stream
- func (s *PipelineStream) Filter(fn interface{}) Stream
- func (s *PipelineStream) FindAny() *Option
- func (s *PipelineStream) FindFirst() *Option
- func (s *PipelineStream) FindLast() *Option
- func (s *PipelineStream) FlatMap(fn interface{}) Stream
- func (s *PipelineStream) Foreach(eachFn interface{})
- func (s *PipelineStream) Limit(size int) Stream
- func (s *PipelineStream) Map(fn interface{}) Stream
- func (s *PipelineStream) Peek(eachFn interface{}) Stream
- func (s *PipelineStream) Reduce(fn, initValue interface{}) interface{}
- func (s *PipelineStream) Skip(size int) Stream
- func (s *PipelineStream) Sort(fn interface{}) Stream
- type Stream
Constants ¶
This section is empty.
Variables ¶
View Source
var None = &Option{nil}
Functions ¶
func HandleError ¶
func HandleError(err *error)
Types ¶
type Option ¶
type Option struct {
// contains filtered or unexported fields
}
func (*Option) And ¶
And returns None if this option is None, otherwise returns the option received.
func (*Option) AndThen ¶
AndThen returns None if this option is None, otherwise calls the received function with the wrapped value and returns the result Option.
type PipelineStream ¶ added in v0.0.2
type PipelineStream struct {
// contains filtered or unexported fields
}
func List ¶ added in v0.0.2
func List(list *list2.List) *PipelineStream
func New ¶ added in v0.0.2
func New(c collection.Collection) *PipelineStream
func Slice ¶
func Slice(slice interface{}) *PipelineStream
func (*PipelineStream) AllMatch ¶ added in v0.0.2
func (s *PipelineStream) AllMatch(fn interface{}) bool
func (*PipelineStream) AnyMatch ¶ added in v0.0.2
func (s *PipelineStream) AnyMatch(fn interface{}) bool
func (*PipelineStream) Collect ¶ added in v0.0.2
func (s *PipelineStream) Collect(collector interface{}) interface{}
func (*PipelineStream) Count ¶ added in v0.0.2
func (s *PipelineStream) Count() int
func (*PipelineStream) Distinct ¶ added in v0.0.2
func (s *PipelineStream) Distinct(fn interface{}) Stream
func (*PipelineStream) Filter ¶ added in v0.0.2
func (s *PipelineStream) Filter(fn interface{}) Stream
func (*PipelineStream) FindAny ¶ added in v0.0.2
func (s *PipelineStream) FindAny() *Option
func (*PipelineStream) FindFirst ¶ added in v0.0.2
func (s *PipelineStream) FindFirst() *Option
func (*PipelineStream) FindLast ¶ added in v0.0.2
func (s *PipelineStream) FindLast() *Option
func (*PipelineStream) FlatMap ¶ added in v0.0.2
func (s *PipelineStream) FlatMap(fn interface{}) Stream
func (*PipelineStream) Foreach ¶ added in v0.0.2
func (s *PipelineStream) Foreach(eachFn interface{})
func (*PipelineStream) Limit ¶ added in v0.0.2
func (s *PipelineStream) Limit(size int) Stream
func (*PipelineStream) Map ¶ added in v0.0.2
func (s *PipelineStream) Map(fn interface{}) Stream
func (*PipelineStream) Peek ¶ added in v0.0.2
func (s *PipelineStream) Peek(eachFn interface{}) Stream
func (*PipelineStream) Reduce ¶ added in v0.0.2
func (s *PipelineStream) Reduce(fn, initValue interface{}) interface{}
func (*PipelineStream) Skip ¶ added in v0.0.2
func (s *PipelineStream) Skip(size int) Stream
func (*PipelineStream) Sort ¶ added in v0.0.2
func (s *PipelineStream) Sort(fn interface{}) Stream
type Stream ¶
type Stream interface { // 获得元素的总数 Count() int // 获得第一个元素 FindFirst() *Option // 获得最后一个元素 // Deprecated: 在使用pipeline方式时间复杂度为O(n) FindLast() *Option // 获得一个随机元素 FindAny() *Option // 过滤元素,返回一个包括所有符合过滤条件的元素的stream // 参数类型为:fn func(TYPE) bool Filter(fn interface{}) Stream // 返回一个不超过给定长度的stream Limit(size int) Stream // 返回一个扔掉了前n个元素的stream Skip(size int) Stream // 返回一个去重的stream // 参数类型为:fn func(t1, t2 TYPE) bool Distinct(fn interface{}) Stream // 返回一个排序后的stream // 参数类型为:fn func(t1, t2 TYPE) int Sort(fn interface{}) Stream // 映射并扁平化为一个stream // 参数类型为:fn func(OLD_TYPE) []NEW_TYPE FlatMap(fn interface{}) Stream // 由一个类型映射到另一个类型 // 参数类型为:fn func(OLD_TYPE) NEW_TYPE Map(fn interface{}) Stream // 迭代流中所有数据 // 参数类型为:fn func(TYPE) Foreach(fn interface{}) // 迭代流中所有数据,并返回stream // 参数类型为:fn func(TYPE) Peek(fn interface{}) Stream // 任意匹配一个则返回true,否则返回false // 参数类型为:fn func(TYPE) bool AnyMatch(fn interface{}) bool // 完全匹配返回true,否则返回false // 参数类型为:fn func(o TYPE) bool AllMatch(fn interface{}) bool // 对stream中元素进行聚合求值 // 参数类型为:fn func(out, in TYPE) interface{} Reduce(fn, initValue interface{}) interface{} // 获得slice // 参数类型为:collector.Collector Collect(collector interface{}) interface{} }
Click to show internal directories.
Click to hide internal directories.