iterator

package
v0.7.7-0...-81dcd7d Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2024 License: Apache-2.0 Imports: 9 Imported by: 513

Documentation

Index

Constants

View Source
const MaterializeLimit = 1000

Variables

View Source
var DefaultMaxRecursiveSteps = 50

Functions

func Height

func Height(it Shape, filter func(Shape) bool) int

Height is a convienence function to measure the height of an iterator tree.

func IsNull added in v0.7.6

func IsNull(it Shape) bool

func RunFloatOp added in v0.6.0

func RunFloatOp(a quad.Float, op Operator, b quad.Float) bool

func RunIntOp

func RunIntOp(a quad.Int, op Operator, b quad.Int) bool

func RunStrOp added in v0.5.0

func RunStrOp(a string, op Operator, b string) bool

func RunTimeOp added in v0.6.0

func RunTimeOp(a time.Time, op Operator, b time.Time) bool

Types

type And

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

The And iterator. Consists of a number of subiterators, the primary of which will be Next()ed if next is called.

func NewAnd

func NewAnd(sub ...Shape) *And

NewAnd creates an And iterator. `qs` is only required when needing a handle for QuadStore-specific optimizations, otherwise nil is acceptable.

func (*And) AddOptionalIterator added in v0.7.6

func (it *And) AddOptionalIterator(sub Shape) *And

AddOptionalIterator adds an iterator that will only be Contain'ed and will not affect iteration results. Only tags will be propagated from this iterator.

func (*And) AddSubIterator

func (it *And) AddSubIterator(sub Shape)

Add a subiterator to this And iterator.

The first iterator that is added becomes the primary iterator. This is important. Calling Optimize() is the way to change the order based on subiterator statistics. Without Optimize(), the order added is the order used.

func (*And) Iterate

func (it *And) Iterate() Scanner

func (*And) Lookup

func (it *And) Lookup() Index

func (*And) Optimize

func (it *And) Optimize(ctx context.Context) (Shape, bool)

Optimizes the And, by picking the most efficient way to Next() and Contains() its subiterators. For SQL fans, this is equivalent to JOIN.

func (*And) Stats

func (it *And) Stats(ctx context.Context) (Costs, error)

Stats lives here in and-iterator-optimize.go because it may in the future return different statistics based on how it is optimized. For now, however, it's pretty static.

Returns the approximate size of the And iterator. Because we're dealing with an intersection, we know that the largest we can be is the size of the smallest iterator. This is the heuristic we shall follow. Better heuristics welcome.

func (*And) String added in v0.7.0

func (it *And) String() string

func (*And) SubIterators

func (it *And) SubIterators() []Shape

Returns a slice of the subiterators, in order (primary iterator first).

type Base

type Base interface {
	// String returns a short textual representation of an iterator.
	String() string

	// Fills a tag-to-result-value map.
	TagResults(map[string]refs.Ref)

	// Returns the current result.
	Result() refs.Ref

	// These methods are the heart and soul of the iterator, as they constitute
	// the iteration interface.
	//
	// To get the full results of iteration, do the following:
	//
	//  for it.Next(ctx) {
	//  	val := it.Result()
	//  	... do things with val.
	//  	for it.NextPath(ctx) {
	//  		... find other paths to iterate
	//  	}
	//  }
	//
	// All of them should set iterator.result to be the last returned value, to
	// make results work.
	//
	// NextPath() advances iterators that may have more than one valid result,
	// from the bottom up.
	NextPath(ctx context.Context) bool

	// Err returns any error that was encountered by the Iterator.
	Err() error

	// Close the iterator and do internal cleanup.
	Close() error
}

Base is a set of common methods for Scanner and Index iterators.

type Chain

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

Chain is a chain-enabled helper to setup iterator execution.

func Iterate

func Iterate(ctx context.Context, it Shape) *Chain

Iterate is a set of helpers for iteration. Context may be used to cancel execution. Iterator will be optimized and closed after execution.

By default, iteration has no limit and includes sub-paths.

func (*Chain) All

func (c *Chain) All() ([]refs.Ref, error)

All will return all results of an iterator.

func (*Chain) AllValues

func (c *Chain) AllValues(qs refs.Namer) ([]quad.Value, error)

AllValues is an analog of All, but it will additionally call NameOf for each graph.Ref before returning the results slice.

func (*Chain) Count

func (c *Chain) Count() (int64, error)

All will return all results of an iterator.

func (*Chain) Each

func (c *Chain) Each(fnc func(refs.Ref) error) error

Each will run a provided callback for each result of the iterator.

func (*Chain) EachValue

func (c *Chain) EachValue(qs refs.Namer, fnc func(quad.Value) error) error

EachValue is an analog of Each, but it will additionally call NameOf for each graph.Ref before passing it to a callback.

func (*Chain) EachValuePair

func (c *Chain) EachValuePair(qs refs.Namer, fnc func(refs.Ref, quad.Value) error) error

EachValuePair is an analog of Each, but it will additionally call NameOf for each graph.Ref before passing it to a callback. Original value will be passed as well.

func (*Chain) First

func (c *Chain) First() (refs.Ref, error)

First will return a first result of an iterator. It returns nil if iterator is empty.

func (*Chain) FirstValue

func (c *Chain) FirstValue(qs refs.Namer) (quad.Value, error)

FirstValue is an analog of First, but it does lookup of a value in QuadStore.

func (*Chain) Limit

func (c *Chain) Limit(n int) *Chain

Limit limits a total number of results returned.

func (*Chain) On

func (c *Chain) On(qs refs.Namer) *Chain

On sets a default quad store for iteration. If qs was set, it may be omitted in other functions.

func (*Chain) Paths

func (c *Chain) Paths(enable bool) *Chain

Paths switches iteration over sub-paths (with it.NextPath). Defaults to true.

func (*Chain) Send

func (c *Chain) Send(out chan<- refs.Ref) error

Send will send each result of the iterator to the provided channel.

Channel will NOT be closed when function returns.

func (*Chain) SendValues

func (c *Chain) SendValues(qs refs.Namer, out chan<- quad.Value) error

SendValues is an analog of Send, but it will additionally call NameOf for each graph.Ref before sending it to a channel.

func (*Chain) TagEach

func (c *Chain) TagEach(fnc func(map[string]refs.Ref) error) error

TagEach will run a provided tag map callback for each result of the iterator.

func (*Chain) TagValues

func (c *Chain) TagValues(qs refs.Namer, fnc func(map[string]quad.Value) error) error

TagValues is an analog of TagEach, but it will additionally call NameOf for each graph.Ref before passing the map to a callback.

func (*Chain) UnOptimized

func (c *Chain) UnOptimized() *Chain

UnOptimized disables iterator optimization.

type Costs

type Costs struct {
	ContainsCost int64
	NextCost     int64
	Size         refs.Size
}

type Count added in v0.6.0

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

Count iterator returns one element with size of underlying iterator.

func NewCount added in v0.6.0

func NewCount(it Shape, qs refs.Namer) *Count

NewCount creates a new iterator to count a number of results from a provided subiterator. qs may be nil - it's used to check if count Contains (is) a given value.

func (*Count) Iterate

func (it *Count) Iterate() Scanner

func (*Count) Lookup

func (it *Count) Lookup() Index

func (*Count) Optimize added in v0.6.0

func (it *Count) Optimize(ctx context.Context) (Shape, bool)

func (*Count) Stats added in v0.6.0

func (it *Count) Stats(ctx context.Context) (Costs, error)

func (*Count) String added in v0.7.0

func (it *Count) String() string

func (*Count) SubIterators added in v0.6.0

func (it *Count) SubIterators() []Shape

SubIterators returns a slice of the sub iterators.

type Error added in v0.7.0

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

Error iterator always returns a single error with no other results.

func NewError added in v0.7.0

func NewError(err error) *Error

func (*Error) Close added in v0.7.0

func (it *Error) Close() error

func (*Error) Contains added in v0.7.0

func (it *Error) Contains(ctx context.Context, v refs.Ref) bool

func (*Error) Err added in v0.7.0

func (it *Error) Err() error

func (*Error) Iterate

func (it *Error) Iterate() Scanner

func (*Error) Lookup

func (it *Error) Lookup() Index

func (*Error) Next added in v0.7.0

func (it *Error) Next(ctx context.Context) bool

func (*Error) NextPath added in v0.7.0

func (it *Error) NextPath(ctx context.Context) bool

func (*Error) Optimize added in v0.7.0

func (it *Error) Optimize(ctx context.Context) (Shape, bool)

func (*Error) Reset added in v0.7.0

func (it *Error) Reset()

func (*Error) Result added in v0.7.0

func (it *Error) Result() refs.Ref

func (*Error) Stats added in v0.7.0

func (it *Error) Stats(ctx context.Context) (Costs, error)

func (*Error) String added in v0.7.0

func (it *Error) String() string

func (*Error) SubIterators added in v0.7.0

func (it *Error) SubIterators() []Shape

func (*Error) TagResults added in v0.7.0

func (it *Error) TagResults(dst map[string]refs.Ref)

Fill the map based on the tags assigned to this iterator.

type Fixed

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

A Fixed iterator consists of it's values, an index (where it is in the process of Next()ing) and an equality function.

func NewFixed added in v0.4.1

func NewFixed(vals ...refs.Ref) *Fixed

NewFixed creates a new Fixed iterator with a custom comparator.

func (*Fixed) Add

func (it *Fixed) Add(v refs.Ref)

Add a value to the iterator. The array now contains this value. TODO(barakmich): This ought to be a set someday, disallowing repeated values.

func (*Fixed) Iterate

func (it *Fixed) Iterate() Scanner

func (*Fixed) Lookup

func (it *Fixed) Lookup() Index

func (*Fixed) Optimize

func (it *Fixed) Optimize(ctx context.Context) (Shape, bool)

Optimize() for a Fixed iterator is simple. Returns a Null iterator if it's empty (so that other iterators upstream can treat this as null) or there is no optimization.

func (*Fixed) Stats

func (it *Fixed) Stats(ctx context.Context) (Costs, error)

As we right now have to scan the entire list, Next and Contains are linear with the size. However, a better data structure could remove these limits.

func (*Fixed) String added in v0.7.0

func (it *Fixed) String() string

func (*Fixed) SubIterators

func (it *Fixed) SubIterators() []Shape

No sub-iterators.

func (*Fixed) Values added in v0.7.1

func (it *Fixed) Values() []refs.Ref

Values returns a list of values stored in iterator. Slice must not be modified.

type Index

type Index interface {
	Base

	// Contains returns whether the value is within the set held by the iterator.
	//
	// It will set Result to the matching subtree. TagResults can be used to collect values from tree branches.
	Contains(ctx context.Context, v refs.Ref) bool
}

Index is an index lookup iterator. It allows to check if an index contains a specific value.

type Int64Node added in v0.6.0

type Int64Node int64

func (Int64Node) IsNode added in v0.6.0

func (Int64Node) IsNode() bool

func (Int64Node) Key added in v0.7.0

func (v Int64Node) Key() interface{}

type Limit added in v0.6.0

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

Limit iterator will stop iterating if certain a number of values were encountered. Zero and negative Limit values means no Limit.

func NewLimit added in v0.6.0

func NewLimit(it Shape, max int64) *Limit

func (*Limit) Iterate

func (it *Limit) Iterate() Scanner

func (*Limit) Lookup

func (it *Limit) Lookup() Index

func (*Limit) Optimize added in v0.6.0

func (it *Limit) Optimize(ctx context.Context) (Shape, bool)

func (*Limit) Stats added in v0.6.0

func (it *Limit) Stats(ctx context.Context) (Costs, error)

func (*Limit) String added in v0.7.0

func (it *Limit) String() string

func (*Limit) SubIterators added in v0.6.0

func (it *Limit) SubIterators() []Shape

SubIterators returns a slice of the sub iterators.

type Materialize added in v0.4.0

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

func NewMaterialize added in v0.4.0

func NewMaterialize(sub Shape) *Materialize

func NewMaterializeWithSize added in v0.7.0

func NewMaterializeWithSize(sub Shape, size int64) *Materialize

func (*Materialize) Iterate

func (it *Materialize) Iterate() Scanner

func (*Materialize) Lookup

func (it *Materialize) Lookup() Index

func (*Materialize) Optimize added in v0.4.0

func (it *Materialize) Optimize(ctx context.Context) (Shape, bool)

func (*Materialize) Stats added in v0.4.0

func (it *Materialize) Stats(ctx context.Context) (Costs, error)

The entire point of Materialize is to amortize the cost by putting it all up front.

func (*Materialize) String added in v0.7.0

func (it *Materialize) String() string

func (*Materialize) SubIterators added in v0.4.0

func (it *Materialize) SubIterators() []Shape

type Morphism added in v0.7.6

type Morphism func(Shape) Shape

type Not added in v0.4.1

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

Not iterator acts like a complement for the primary iterator. It will return all the vertices which are not part of the primary iterator.

func NewNot added in v0.4.1

func NewNot(primaryIt, allIt Shape) *Not

func (*Not) Iterate

func (it *Not) Iterate() Scanner

func (*Not) Lookup

func (it *Not) Lookup() Index

func (*Not) Optimize added in v0.4.1

func (it *Not) Optimize(ctx context.Context) (Shape, bool)

func (*Not) Stats added in v0.4.1

func (it *Not) Stats(ctx context.Context) (Costs, error)

func (*Not) String added in v0.7.0

func (it *Not) String() string

func (*Not) SubIterators added in v0.4.1

func (it *Not) SubIterators() []Shape

SubIterators returns a slice of the sub iterators. The first iterator is the primary iterator, for which the complement is generated.

type Null

type Null struct{}

Null is the simplest iterator -- the Null iterator. It contains nothing. It is the empty set. Often times, queries that contain one of these match nothing, so it's important to give it a special iterator.

func NewNull

func NewNull() *Null

NewNull creates a new Null iterator Fairly useless New function.

func (*Null) Close

func (it *Null) Close() error

func (*Null) Contains

func (it *Null) Contains(ctx context.Context, v refs.Ref) bool

func (*Null) Err added in v0.4.1

func (it *Null) Err() error

func (*Null) Iterate

func (it *Null) Iterate() Scanner

Iterate implements Iterator

func (*Null) Lookup

func (it *Null) Lookup() Index

Lookup implements Iterator

func (*Null) Next

func (it *Null) Next(ctx context.Context) bool

func (*Null) NextPath added in v0.4.0

func (it *Null) NextPath(ctx context.Context) bool

func (*Null) Optimize

func (it *Null) Optimize(ctx context.Context) (Shape, bool)

A good iterator will close itself when it returns true. Null has nothing it needs to do.

func (*Null) Reset

func (it *Null) Reset()

func (*Null) Result

func (it *Null) Result() refs.Ref

func (*Null) Stats

func (it *Null) Stats(ctx context.Context) (Costs, error)

A null iterator costs nothing. Use it!

func (*Null) String added in v0.7.0

func (it *Null) String() string

func (*Null) SubIterators

func (it *Null) SubIterators() []Shape

func (*Null) TagResults

func (it *Null) TagResults(dst map[string]refs.Ref)

Fill the map based on the tags assigned to this iterator.

type Operator

type Operator int
const (
	CompareLT Operator = iota
	CompareLTE
	CompareGT
	CompareGTE
)

func (Operator) String added in v0.7.1

func (op Operator) String() string

type Or

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

func NewOr

func NewOr(sub ...Shape) *Or

func NewShortCircuitOr

func NewShortCircuitOr(sub ...Shape) *Or

func (*Or) AddSubIterator

func (it *Or) AddSubIterator(sub Shape)

Add a subiterator to this Or iterator. Order matters.

func (*Or) Iterate

func (it *Or) Iterate() Scanner

func (*Or) Lookup

func (it *Or) Lookup() Index

func (*Or) Optimize

func (it *Or) Optimize(ctx context.Context) (Shape, bool)

func (*Or) Stats

func (it *Or) Stats(ctx context.Context) (Costs, error)

Returns the approximate size of the Or iterator. Because we're dealing with a union, we know that the largest we can be is the sum of all the iterators, or in the case of short-circuiting, the longest.

func (*Or) String added in v0.7.0

func (it *Or) String() string

func (*Or) SubIterators

func (it *Or) SubIterators() []Shape

Returns a list.List of the subiterators, in order. The returned slice must not be modified.

type Recursive added in v0.6.1

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

Recursive iterator takes a base iterator and a morphism to be applied recursively, for each result.

func NewRecursive added in v0.6.1

func NewRecursive(it Shape, morphism Morphism, maxDepth int) *Recursive

func (*Recursive) AddDepthTag added in v0.6.1

func (it *Recursive) AddDepthTag(s string)

func (*Recursive) Iterate

func (it *Recursive) Iterate() Scanner

func (*Recursive) Lookup

func (it *Recursive) Lookup() Index

func (*Recursive) Optimize added in v0.6.1

func (it *Recursive) Optimize(ctx context.Context) (Shape, bool)

func (*Recursive) Stats added in v0.6.1

func (it *Recursive) Stats(ctx context.Context) (Costs, error)

func (*Recursive) String added in v0.7.0

func (it *Recursive) String() string

func (*Recursive) SubIterators added in v0.6.1

func (it *Recursive) SubIterators() []Shape

type Resolver added in v0.7.5

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

A Resolver iterator consists of it's order, an index (where it is in the, process of iterating) and a store to resolve values from.

func NewResolver added in v0.7.5

func NewResolver(qs refs.Namer, nodes ...quad.Value) *Resolver

NewResolver creates a new Resolver iterator.

func (*Resolver) Iterate

func (it *Resolver) Iterate() Scanner

func (*Resolver) Lookup

func (it *Resolver) Lookup() Index

func (*Resolver) Optimize added in v0.7.5

func (it *Resolver) Optimize(ctx context.Context) (Shape, bool)

Returns a Null iterator if it's empty so that upstream iterators can optimize it away, otherwise there is no optimization.

func (*Resolver) Stats added in v0.7.5

func (it *Resolver) Stats(ctx context.Context) (Costs, error)

func (*Resolver) String added in v0.7.5

func (it *Resolver) String() string

func (*Resolver) SubIterators added in v0.7.5

func (it *Resolver) SubIterators() []Shape

type Save added in v0.7.6

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

func NewSave added in v0.7.6

func NewSave(on Shape, tags ...string) *Save

func (*Save) AddFixedTag added in v0.7.6

func (it *Save) AddFixedTag(tag string, value refs.Ref)

func (*Save) AddTags added in v0.7.6

func (it *Save) AddTags(tag ...string)

Add a tag to the iterator.

func (*Save) CopyFromTagger added in v0.7.6

func (it *Save) CopyFromTagger(st TaggerBase)

func (*Save) FixedTags added in v0.7.6

func (it *Save) FixedTags() map[string]refs.Ref

Fixed returns the fixed tags held in the tagger. The returned value must not be mutated.

func (*Save) Iterate

func (it *Save) Iterate() Scanner

func (*Save) Lookup

func (it *Save) Lookup() Index

func (*Save) Optimize

func (it *Save) Optimize(ctx context.Context) (nit Shape, no bool)

func (*Save) Stats

func (it *Save) Stats(ctx context.Context) (Costs, error)

func (*Save) String

func (it *Save) String() string

func (*Save) SubIterators

func (it *Save) SubIterators() []Shape

func (*Save) Tags added in v0.7.6

func (it *Save) Tags() []string

Tags returns the tags held in the tagger. The returned value must not be mutated.

type Scanner

type Scanner interface {
	Base

	// Next advances the iterator to the next value, which will then be available through
	// the Result method. It returns false if no further advancement is possible, or if an
	// error was encountered during iteration.  Err should be consulted to distinguish
	// between the two cases.
	Next(ctx context.Context) bool
}

Scanner is an iterator that lists all results sequentially, but not necessarily in a sorted order.

func NewLimitNext

func NewLimitNext(it Scanner, limit int64) Scanner

type Shape

type Shape interface {

	// String returns a short textual representation of an iterator.
	String() string

	// Iterate starts this iterator in scanning mode. Resulting iterator will list all
	// results sequentially, but not necessary in the sorted order. Caller must close
	// the iterator.
	Iterate() Scanner

	// Lookup starts this iterator in an index lookup mode. Depending on the iterator type,
	// this may still involve database scans. Resulting iterator allows to check an index
	// contains a specified value. Caller must close the iterator.
	Lookup() Index

	// These methods relate to choosing the right iterator, or optimizing an
	// iterator tree
	//
	// Stats() returns the relative costs of calling the iteration methods for
	// this iterator, as well as the size. Roughly, it will take NextCost * Size
	// "cost units" to get everything out of the iterator. This is a wibbly-wobbly
	// thing, and not exact, but a useful heuristic.
	Stats(ctx context.Context) (Costs, error)

	// Optimizes an iterator. Can replace the iterator, or merely move things
	// around internally. if it chooses to replace it with a better iterator,
	// returns (the new iterator, true), if not, it returns (self, false).
	Optimize(ctx context.Context) (Shape, bool)

	// Return a slice of the subiterators for this iterator.
	SubIterators() []Shape
}

Shape is an iterator shape, similar to a query plan. But the plan is not specific in this case - it is used to reorder query branches, and the decide what branches will be scanned and what branches will lookup values (hopefully from the index, but not necessarily).

func NewComparison

func NewComparison(sub Shape, op Operator, val quad.Value, qs refs.Namer) Shape

func NewRegex added in v0.6.0

func NewRegex(sub Shape, re *regexp.Regexp, qs refs.Namer) Shape

NewRegex returns an unary operator -- a filter across the values in the relevant subiterator. It works similarly to gremlin's filter{it.matches('exp')}, reducing the iterator set to values whose string representation passes a regular expression test.

func NewRegexWithRefs added in v0.7.6

func NewRegexWithRefs(sub Shape, re *regexp.Regexp, qs refs.Namer) Shape

NewRegexWithRefs is like NewRegex but allows regexp iterator to match IRIs and BNodes.

Consider using it carefully. In most cases it's better to reconsider your graph structure instead of relying on slow unoptimizable regexp.

An example of incorrect usage is to match IRIs:

<http://example.org/page>
<http://example.org/page/foo>

Via regexp like:

http://example.org/page.*

The right way is to explicitly link graph nodes and query them by this relation:

<http://example.org/page/foo> <type> <http://example.org/page>

func Tag added in v0.7.6

func Tag(it Shape, tag string) Shape

type Skip added in v0.6.0

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

Skip iterator will skip certain number of values from primary iterator.

func NewSkip added in v0.6.0

func NewSkip(primaryIt Shape, off int64) *Skip

func (*Skip) Iterate

func (it *Skip) Iterate() Scanner

func (*Skip) Lookup

func (it *Skip) Lookup() Index

func (*Skip) Optimize added in v0.6.0

func (it *Skip) Optimize(ctx context.Context) (Shape, bool)

func (*Skip) Stats added in v0.6.0

func (it *Skip) Stats(ctx context.Context) (Costs, error)

func (*Skip) String added in v0.7.0

func (it *Skip) String() string

func (*Skip) SubIterators added in v0.6.0

func (it *Skip) SubIterators() []Shape

SubIterators returns a slice of the sub iterators.

type Sort added in v0.7.6

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

Sort iterator orders values from it's subiterator.

func NewSort added in v0.7.6

func NewSort(namer refs.Namer, subIt Shape) *Sort

NewSort creates a new Sort iterator. TODO(dennwc): This iterator must not be used inside And: it may be moved to a Contains branch and won't do anything.

We should make And/Intersect account for this.

func (*Sort) Iterate

func (it *Sort) Iterate() Scanner

func (*Sort) Lookup

func (it *Sort) Lookup() Index

func (*Sort) Optimize

func (it *Sort) Optimize(ctx context.Context) (Shape, bool)

func (*Sort) Stats

func (it *Sort) Stats(ctx context.Context) (Costs, error)

func (*Sort) String

func (it *Sort) String() string

func (*Sort) SubIterators

func (it *Sort) SubIterators() []Shape

SubIterators returns a slice of the sub iterators.

type TaggerBase

type TaggerBase interface {
	Tags() []string
	FixedTags() map[string]refs.Ref
	AddTags(tag ...string)
	AddFixedTag(tag string, value refs.Ref)
}

TaggerBase is a base interface for Tagger and TaggerShape.

type TaggerShape

type TaggerShape interface {
	Shape
	TaggerBase
	CopyFromTagger(st TaggerBase)
}

TaggerShape is an interface for iterators that can tag values. Tags are returned as a part of TagResults call.

type Unique added in v0.5.0

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

Unique iterator removes duplicate values from it's subiterator.

func NewUnique added in v0.5.0

func NewUnique(subIt Shape) *Unique

func (*Unique) Iterate

func (it *Unique) Iterate() Scanner

func (*Unique) Lookup

func (it *Unique) Lookup() Index

func (*Unique) Optimize added in v0.5.0

func (it *Unique) Optimize(ctx context.Context) (Shape, bool)

func (*Unique) Stats added in v0.5.0

func (it *Unique) Stats(ctx context.Context) (Costs, error)

func (*Unique) String added in v0.7.0

func (it *Unique) String() string

func (*Unique) SubIterators added in v0.5.0

func (it *Unique) SubIterators() []Shape

SubIterators returns a slice of the sub iterators. The first iterator is the primary iterator, for which the complement is generated.

type ValueFilter added in v0.7.6

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

func NewValueFilter added in v0.7.6

func NewValueFilter(qs refs.Namer, sub Shape, filter ValueFilterFunc) *ValueFilter

func (*ValueFilter) Iterate

func (it *ValueFilter) Iterate() Scanner

func (*ValueFilter) Lookup

func (it *ValueFilter) Lookup() Index

func (*ValueFilter) Optimize

func (it *ValueFilter) Optimize(ctx context.Context) (Shape, bool)

There's nothing to optimize, locally, for a value-comparison iterator. Replace the underlying iterator if need be. potentially replace it.

func (*ValueFilter) Stats

func (it *ValueFilter) Stats(ctx context.Context) (Costs, error)

We're only as expensive as our subiterator. Again, optimized value comparison iterators should do better.

func (*ValueFilter) String

func (it *ValueFilter) String() string

func (*ValueFilter) SubIterators

func (it *ValueFilter) SubIterators() []Shape

type ValueFilterFunc added in v0.7.6

type ValueFilterFunc func(quad.Value) (bool, error)

Jump to

Keyboard shortcuts

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