import "github.com/facebookincubator/ent/dialect/gremlin/graph/dsl"
Package dsl provide an API for writing gremlin dsl queries almost as-is in Go without using strings in the code.
Note that, the API is not type-safe and assume the provided query and its arguments are valid.
predefined nodes.
Bindings are used to associate a variable with a value.
Add adds new value to the bindings map, formats it if needed, and returns its generated name.
type Block struct {
Nodes []interface{}
}
Block represents a block/group of nodes.
Code returns the code representation of group/block of nodes.
Cardinality of vertex properties.
const ( Set Cardinality = "set" Single Cardinality = "single" )
Cardinality options.
func (c Cardinality) Code() (string, []interface{})
Code implements the Node interface.
Column references a particular type of column in a complex data structure such as a Map, a Map.Entry, or a Path.
Column options.
Code implements the Node interface.
Func represents a function call.
NewFunc returns a new function node.
Code returns the code representation of a function call.
type List struct {
Elements []interface{}
}
List represents a list of elements.
NewList returns a new list node.
Code returns the code representation of a list.
type Node interface { // Code returns the code representation of the element and its bindings (if any). Code() (string, []interface{}) }
Node represents a DSL step in the traversal.
Order of vertex properties.
Order options.
Code implements the Node interface.
type Querier interface { // Query returns the query-string (similar to the Gremlin byte-code) and its bindings. Query() (string, Bindings) }
Querier is the interface that wraps the Query method.
Scope used for steps that have a variable scope which alter the manner in which the step will behave in relation to how the traverses are processed.
Scope options.
Code implements the Node interface.
Token holds a simple token, like assignment.
Code stringified the token.
type Traversal struct {
// contains filtered or unexported fields
}
Traversal mimics the TinkerPop graph traversal.
Each is a Groovy each-loop function.
Group groups a list of traversals into one. all traversals are assigned into a temporary variables named by their index. The last variable functions as a return value of the query. Note that, this "temporary hack" is not perfect and may not work in some cases because of the limitation of evaluation order.
Join joins a list of traversals with a semicolon separator.
NewTraversal returns a new default traversal with "g" as a reference name to the Graph.
Add is the public API for adding new nodes to the traversal by its sub packages.
AddE adds an edge.
AddV adds a vertex.
And ensures that all of the provided traversals yield a result.
As provides a label to the step that can be accessed later in the traversal by other steps.
Both maps the Vertex to its adjacent vertices given the edge labels.
BothE maps the Vertex to its incident edges given the edge labels.
By can be applied to a number of different step to alter their behaviors. This form is essentially an identity() modulation.
Choose routes the current traverser to a particular traversal branch option which allows the creation of if-then-else like semantics within a traversal.
Clone creates a deep copy of an existing traversal.
Coalesce evaluates the provided traversals and returns the result of the first traversal to emit at least one object.
Constant maps any object to a fixed E value.
Count maps the traversal stream to its reduction as a sum of the Traverser.bulk() values (i.e. count the number of traversers up to this point).
Dedup removes all duplicates in the traversal stream up to this point.
Drop removes elements and properties from the graph.
E step is usually used to start a traversal but it may also be used mid-traversal.
Fold rolls up objects in the stream into an aggregate list..
From provides from()-modulation to respective steps.
Group organizes objects in the stream into a Map.Calls to group() are typically accompanied with by() modulators which help specify how the grouping should occur.
Has filters vertices, edges and vertex properties based on their properties. See: http://tinkerpop.apache.org/docs/current/reference/#has-step.
HasID filters vertices, edges and vertex properties based on their identifier.
HasLabel filters vertices, edges and vertex properties based on their label.
HasNext returns true if the iteration has more elements.
HasNot filters vertices, edges and vertex properties based on the non-existence of properties. See: http://tinkerpop.apache.org/docs/current/reference/#has-step.
ID maps the Element to its Element.id().
In maps the Vertex to its incoming adjacent vertices given the edge labels.
InE maps the Vertex to its incoming incident edges given the edge labels.
InV maps the Edge to its incoming/head incident Vertex.
Is filters the E object if it is not P.eq(V) to the provided value.
Iterate iterates the traversal presumably for the generation of side-effects.
Label maps the Element to its Element.label().
Limit filters the objects in the traversal by the number of them to pass through the stream, where only the first n objects are allowed as defined by the limit argument.
Match maps the Traverser to a Map of bindings as specified by the provided match traversals.
Max determines the greatest value in the stream.
Mean determines the mean value in the stream.
Min determines the smallest value in the stream.
Next gets the next n-number of results from the traversal.
Not removes objects from the traversal stream when the traversal provided as an argument does not return any objects.
Or ensures that at least one of the provided traversals yield a result.
Order all the objects in the traversal up to this point and then emit them one-by-one in their ordered sequence.
OtherV maps the Edge to the incident vertex that was not just traversed from in the path history.
Out maps the Vertex to its outgoing adjacent vertices given the edge labels.
OutE maps the Vertex to its outgoing incident edges given the edge labels.
OutV maps the Edge to its outgoing/tail incident Vertex.
Properties maps the Element to its associated properties given the provide property keys.
Property sets a Property value and related meta properties if supplied, if supported by the Graph and if the Element is a VertexProperty.
Query returns the query-representation and its binding of this traversal object.
Range filters the objects in the traversal by the number of them to pass through the stream.
Select arbitrary values from the traversal.
SideEffect allows the traverser to proceed unchanged, but yield some computational sideEffect in the process.
Sum maps the traversal stream to its reduction as a sum of the Traverser.get() values multiplied by their Traverser.bulk().
To used as a modifier to addE(String) this method specifies the traversal to use for selecting the incoming vertex of the newly added Edge.
ToList puts all the results into a Groovy list.
Undo reverts the last-step of the traversal.
Unfold unrolls a Iterator, Iterable or Map into a linear form or simply emits the object if it is not one of those types.
Union merges the results of an arbitrary number of traversals.
V step is usually used to start a traversal but it may also be used mid-traversal.
ValueMap maps the Element to a Map of the property values key'd according to their Property.key().
Values maps the Element to the values of the associated properties given the provide property keys.
Where filters the current object based on the object itself or the path history.
Var represents a variable assignment and usage.
Code returns the code representation of variable declaration or its identifier.
Path | Synopsis |
---|---|
__ | |
g | |
p |
Package dsl imports 3 packages (graph). Updated 2020-09-02. Refresh now. Tools for package owners.