builder

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2022 License: MIT Imports: 3 Imported by: 80

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExploreFieldsSpecBuilder

type ExploreFieldsSpecBuilder interface {
	Insert(k string, v SelectorSpec)
}

ExploreFieldsSpecBuilder is an interface for assemble the map of fields to selectors in ExploreFields

type ExploreFieldsSpecBuildingClosure

type ExploreFieldsSpecBuildingClosure func(ExploreFieldsSpecBuilder)

ExploreFieldsSpecBuildingClosure is a function that provided to SelectorSpecBuilder's ExploreFields method that assembles the fields map in the selector using an ExploreFieldsSpecBuilder

type SelectorSpec

type SelectorSpec interface {
	Node() datamodel.Node
	Selector() (selector.Selector, error)
}

SelectorSpec is a specification for a selector that can build a selector datamodel.Node or an actual parsed Selector

type SelectorSpecBuilder

type SelectorSpecBuilder interface {
	ExploreRecursiveEdge() SelectorSpec
	ExploreRecursive(limit selector.RecursionLimit, sequence SelectorSpec) SelectorSpec
	ExploreUnion(...SelectorSpec) SelectorSpec
	ExploreAll(next SelectorSpec) SelectorSpec
	ExploreIndex(index int64, next SelectorSpec) SelectorSpec
	ExploreRange(start, end int64, next SelectorSpec) SelectorSpec
	ExploreFields(ExploreFieldsSpecBuildingClosure) SelectorSpec
	ExploreInterpretAs(as string, next SelectorSpec) SelectorSpec
	Matcher() SelectorSpec
	MatcherSubset(from, to int64) SelectorSpec
}

SelectorSpecBuilder is a utility interface to build selector ipld nodes quickly.

It serves two purposes: 1. Save the user of go-ipld time and mental overhead with an easy interface for making selector nodes in much less code without having to remember the selector sigils 2. Provide a level of protection from selector schema changes, at least in terms of naming, if not structure

func NewSelectorSpecBuilder

func NewSelectorSpecBuilder(np datamodel.NodePrototype) SelectorSpecBuilder

NewSelectorSpecBuilder creates a SelectorSpecBuilder which will store data in the format determined by the given datamodel.NodePrototype.

Jump to

Keyboard shortcuts

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