collections

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2018 License: MIT Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrExhausted = core.Error(core.ErrInvalidOperation, "iterator has been exhausted")
)

Functions

func IsValidSortDirection

func IsValidSortDirection(direction SortDirection) bool

func ToArray

func ToArray(iterator Iterator) (*values.Array, error)

func ToHashTable

func ToHashTable(iterator Iterator) (map[uint64]core.Value, error)

func ToMap

func ToMap(iterator Iterator) (map[string]core.Value, error)

func ToSlice

func ToSlice(iterator Iterator) ([]core.Value, error)

Types

type ArrayIterator

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

func NewArrayIterator

func NewArrayIterator(input *values.Array) *ArrayIterator

func (*ArrayIterator) HasNext

func (iterator *ArrayIterator) HasNext() bool

func (*ArrayIterator) Next

func (iterator *ArrayIterator) Next() (core.Value, core.Value, error)

type Collection

type Collection interface {
	Length() values.Int
}

type Comparator

type Comparator func(first core.Value, second core.Value) (int, error)

type FilterIterator

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

func NewFilterIterator

func NewFilterIterator(src Iterator, predicate FilterPredicate) (*FilterIterator, error)

func (*FilterIterator) HasNext

func (iterator *FilterIterator) HasNext() bool

func (*FilterIterator) Next

func (iterator *FilterIterator) Next() (core.Value, core.Value, error)

type FilterPredicate

type FilterPredicate func(val core.Value, key core.Value) (bool, error)

type GroupIterator

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

func NewGroupIterator

func NewGroupIterator(
	src Iterator,
	keys ...GroupKey,
) (*GroupIterator, error)

func (*GroupIterator) HasNext

func (iterator *GroupIterator) HasNext() bool

func (*GroupIterator) Next

func (iterator *GroupIterator) Next() (core.Value, core.Value, error)

type GroupKey

type GroupKey func(value core.Value) (core.Value, error)

type HTMLNodeIterator

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

func NewHTMLNodeIterator

func NewHTMLNodeIterator(input values.HTMLNode) *HTMLNodeIterator

func (*HTMLNodeIterator) HasNext

func (iterator *HTMLNodeIterator) HasNext() bool

func (*HTMLNodeIterator) Next

func (iterator *HTMLNodeIterator) Next() (core.Value, core.Value, error)

type Iterable

type Iterable interface {
	Iterate() Iterator
}

type IterableExpression

type IterableExpression interface {
	core.Expression
	Iterate(ctx context.Context, scope *core.Scope) (Iterator, error)
}

type Iterator

type Iterator interface {
	HasNext() bool
	Next() (value core.Value, key core.Value, err error)
}

func ToIterator

func ToIterator(value core.Value) (Iterator, error)

type LimitIterator

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

func NewLimitIterator

func NewLimitIterator(src Iterator, count, offset int) (*LimitIterator, error)

func (*LimitIterator) HasNext

func (i *LimitIterator) HasNext() bool

func (*LimitIterator) Next

func (i *LimitIterator) Next() (core.Value, core.Value, error)

type MapIterator

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

func NewMapIterator

func NewMapIterator(input map[string]core.Value) *MapIterator

func (*MapIterator) HasNext

func (iterator *MapIterator) HasNext() bool

func (*MapIterator) Next

func (iterator *MapIterator) Next() (core.Value, core.Value, error)

type ObjectIterator

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

func NewObjectIterator

func NewObjectIterator(input *values.Object) *ObjectIterator

func (*ObjectIterator) HasNext

func (iterator *ObjectIterator) HasNext() bool

func (*ObjectIterator) Next

func (iterator *ObjectIterator) Next() (core.Value, core.Value, error)

type Reducer

type Reducer interface {
	Reduce(collection core.Value, value core.Value) (core.Value, error)
}

type Reducible

type Reducible interface {
	Reduce() Reducer
}

type ReducibleExpression

type ReducibleExpression interface {
	core.Expression
	Reduce(ctx context.Context, scope *core.Scope) (Reducer, error)
}

type SliceIterator

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

func NewSliceIterator

func NewSliceIterator(input []core.Value) *SliceIterator

func (*SliceIterator) HasNext

func (iterator *SliceIterator) HasNext() bool

func (*SliceIterator) Next

func (iterator *SliceIterator) Next() (core.Value, core.Value, error)

type SortDirection

type SortDirection int
const (
	SortDirectionAsc  SortDirection = 1
	SortDirectionDesc SortDirection = -1
)

func SortDirectionFromString

func SortDirectionFromString(str string) SortDirection

type SortIterator

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

func NewSortIterator

func NewSortIterator(
	src Iterator,
	comparators ...*Sorter,
) (*SortIterator, error)

func (*SortIterator) HasNext

func (iterator *SortIterator) HasNext() bool

func (*SortIterator) Next

func (iterator *SortIterator) Next() (core.Value, core.Value, error)

type Sorter

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

func NewSorter

func NewSorter(fn Comparator, direction SortDirection) (*Sorter, error)

type UniqueIterator

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

func NewUniqueIterator

func NewUniqueIterator(src Iterator) (*UniqueIterator, error)

func (*UniqueIterator) HasNext

func (iterator *UniqueIterator) HasNext() bool

func (*UniqueIterator) Next

func (iterator *UniqueIterator) Next() (core.Value, core.Value, error)

Jump to

Keyboard shortcuts

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