stream

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2019 License: MIT Imports: 25 Imported by: 3

Documentation

Overview

Package stream contains the implementations for the possible operations in a Stream

Index

Constants

View Source
const OpCodeOut = "out"

OpCodeOut identifier for operation out

View Source
const OpCodeWith = "with"

OpCodeWith identifier for operation with

Variables

This section is empty.

Functions

This section is empty.

Types

type Output

type Output struct {
	// contains filtered or unexported fields
}

Output structure for returning single values

func (Output) Bool

func (o Output) Bool() bool

Bool parses the Output of the Stream as a bool type

func (Output) Err

func (o Output) Err() *errors.Error

Err reurn the error in the Stream

func (Output) Float32

func (o Output) Float32() float32

Float32 parses the Output of the Stream as a Uint float32

func (Output) Float64

func (o Output) Float64() float64

Float64 parses the Output of the Stream as a Uint float64

func (Output) Int

func (o Output) Int() int

Int parses the Output of the Stream as a int type

func (Output) Int16

func (o Output) Int16() int16

Int16 parses the Output of the Stream as a int16 type

func (Output) Int32

func (o Output) Int32() int32

Int32 parses the Output of the Stream as a int32 type

func (Output) Int64

func (o Output) Int64() int64

Int64 parses the Output of the Stream as a int64 type

func (Output) Int8

func (o Output) Int8() int8

Int8 parses the Output of the Stream as a int8 type

func (Output) String

func (o Output) String() string

String parses the Output of the Stream as a string type

func (Output) Uint

func (o Output) Uint() uint

Uint parses the Output of the Stream as a Uint type

func (Output) Uint16

func (o Output) Uint16() uint16

Uint16 parses the Output of the Stream as a Uint type16

func (Output) Uint32

func (o Output) Uint32() uint32

Uint32 parses the Output of the Stream as a Uint type32

func (Output) Uint64

func (o Output) Uint64() uint64

Uint64 parses the Output of the Stream as a Uint type64

func (Output) Uint8

func (o Output) Uint8() uint8

Uint8 parses the Output of the Stream as a Uint type8

func (Output) Val

func (o Output) Val() interface{}

Val reurn the Output of the Stream

type Stream

type Stream struct {
	// contains filtered or unexported fields
}

Stream stream structure

func Error

func Error(err *errors.Error) Stream

Error initialize the Stream with error

func New

func New(items interface{}) Stream

New creates a Stream with the provided array of elements

func (Stream) Add

func (s Stream) Add(input interface{}) Stream

Add operation to add a new element in the stream

func (Stream) At

func (s Stream) At(index int) *Output

At returns the element in the Stream in the given position

func (Stream) Concat added in v0.0.4

func (s Stream) Concat(input interface{}) Stream

Concat concats the orderof the elements in the stream

func (Stream) Contains

func (s Stream) Contains(element interface{}) (bool, *errors.Error)

Contains check if the passed element is found in the Stream

func (Stream) Count

func (s Stream) Count() (int, *errors.Error)

Count function that returns the number of elements in the Stream

func (Stream) DeleteAt added in v0.0.3

func (s Stream) DeleteAt(index int) Stream

DeleteAt deletes the element in the given position

func (Stream) Do

func (s Stream) Do() Stream

Do perform the queue of operations in the stream

func (Stream) Drop

func (s Stream) Drop(input interface{}) Stream

Drop remove all the occurrences for the given input

func (Stream) DropLeft added in v0.0.5

func (s Stream) DropLeft(input interface{}) Stream

DropLeft remove left of element that matches input

func (Stream) DropRight added in v0.0.5

func (s Stream) DropRight(input interface{}) Stream

DropRight remove right of element that matches input

func (Stream) DropWhile added in v0.0.4

func (s Stream) DropWhile(fn interface{}) Stream

DropWhile discard the elements in the Stream that don't match with the provided dropWhile

func (Stream) Filter

func (s Stream) Filter(fn interface{}) Stream

Filter discard the elements in the Stream that don't match with the provided filter

func (Stream) First

func (s Stream) First() *Output

First returns the first element in the stream

func (Stream) ForEach

func (s Stream) ForEach(fn interface{}) Stream

ForEach executes the provided function for all the elements in the Stream

func (Stream) GroupBy added in v0.0.4

func (s Stream) GroupBy(fn interface{}) (reflect.Value, *errors.Error)

IndexesOf check if the passed element is found in the Stream

func (Stream) IndexOf added in v0.0.3

func (s Stream) IndexOf(element interface{}) (int, *errors.Error)

IndexOf check if the passed element is found in the Stream

func (Stream) IndexesOf added in v0.0.4

func (s Stream) IndexesOf(element interface{}) ([]int, *errors.Error)

IndexesOf check if the passed element is found in the Stream

func (Stream) Last

func (s Stream) Last() *Output

Last returns the last element in the stream

func (Stream) LastIndexOf added in v0.0.3

func (s Stream) LastIndexOf(element interface{}) (int, *errors.Error)

LastIndexOf check if the passed element is found in the Stream

func (Stream) Map

func (s Stream) Map(fn interface{}) Stream

Map performs a mutation over all the elements in the Stream and return a new Stream

func (Stream) Out

func (s Stream) Out() *Output

Out returns the slice for the stream

func (Stream) Pop added in v0.0.3

func (s Stream) Pop() (*Output, Stream)

Pop returns the first element and the rest of the stream

func (Stream) Reduce

func (s Stream) Reduce(fn interface{}) Output

Reduce operation to calculate a single value from a stream

func (Stream) RemoveDuplicates

func (s Stream) RemoveDuplicates() Stream

RemoveDuplicates remove all thoese elements are duplicated in the Stream, leaving only an element with the same value

func (Stream) Reverse added in v0.0.3

func (s Stream) Reverse() Stream

Reverse reverses the orderof the elements in the stream

func (Stream) Set added in v0.0.3

func (s Stream) Set(index int, input interface{}) Stream

Set operation to set a new element in the stream

func (Stream) Sort

func (s Stream) Sort(fn interface{}) Stream

Sort sorts the elements in the Stream by applying the provided function

func (Stream) Take added in v0.0.3

func (s Stream) Take(firstIndex, lastIndex int) Stream

Take take the elements between the given indexes

func (Stream) With

func (s Stream) With(data interface{}) Stream

With load the provided elements in the stream

Jump to

Keyboard shortcuts

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