gremlingo

package
v3.5.4 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2022 License: Apache-2.0 Imports: 22 Imported by: 12

README

Getting Started

Prerequisites

  • gremlin-go requires Golang 1.17 or later, please see Go Download for more details on installing Golang.
  • A basic understanding of Go Modules
  • A project set up which uses Go Modules

Installing the Gremlin-Go as a dependency

To install the Gremlin-Go as a dependency for your project, run the following in the root directory of your project that contains your go.mod file:

go get github.com/apache/tinkerpop/gremlin-go/v3[optionally append @<version>, such as @v3.5.3 - note this requires GO111MODULE=on]

Available versions can be found at pkg.go.dev.

After running the go get command, your go.mod file should contain something similar to the following:

module gremlin-go-example

go 1.17

require github.com/apache/tinkerpop/gremlin-go/v3 v<version>

If it does, then this means Gremlin-Go was successfully installed as a dependency of your project.

You will need to run go mod tidy to import the remaining dependencies of the gremlin-go driver (if your IDE does not do so automatically), after which you should see an updated go.mod file:

module gremlin-go-example

go 1.17

require github.com/apache/tinkerpop/gremlin-go v0.0.0-20220131225152-54920637bf94

require (
	github.com/google/uuid v1.3.0 // indirect
	github.com/gorilla/websocket v1.4.2 // indirect
	github.com/nicksnyder/go-i18n/v2 v2.1.2 // indirect
	golang.org/x/text v0.3.7 // indirect
)

As well as a populated go.sum file.

if there are no usages for gremlingo found, it will remove the require from go.mod and not import dependencies.

Simple usage

For instructions on simple usage, including connecting, connection settings, aliases and more, check out the Gremlin-Go section in the Tinkerpop Documentation.

Troubleshooting

Can't establish connection and get any result
  • Verify you are using valid server protocol and path. Note that for secure connection wss should be used.
  • Verify firewall settings.
Local server doesn't have valid certificate
  • Set connection option &tls.Config{InsecureSkipVerify: true}
Client hangs on requests with large amount of data
  • Increase read buffer size by settings connection option readBufferSize.

Gremlin-Go Development

Design Architecture

See Gremlin-Go Design Overview

Building Directly

To build the driver you must install go. The following command can be used to build the driver: go build <path to source code>

Code Styling and Linting

Before generating a pull request, you should manually run the following to ensure correct code styling and fix any issues indicated by the linters.

Formatting files with Gofmt

To ensure clean and readable code Gofmt is used.

Navigate to file path in a terminal window and run:

go fmt

Gofmt will recursively check for and format .go files.

Note: If your IDE of choice is GoLand, code can be automatically formatted with Gofmt on file save. Instructions on how to enable this feature can be found here.

Using the Linter and staticcheck

Run go vet and staticcheck and correct any errors.

go vet is installed when you install go, and can be run with:

go vet <path to source code>

Please review the staticcheck documentation for more details on installing staticcheck. It can be run with:

staticcheck <path to source code>

Testing with Docker

Docker allows you to test the driver without installing any dependencies. Please make sure Docker is installed and running on your system. You will need to install both Docker Engine and Docker Compose, which are included in Docker Desktop.

The docker compose environment variable GREMLIN_SERVER specifies the Gremlin server docker image to use, i.e. an image with the tag tinkerpop/gremlin-server:$GREMLIN_SERVER, and is a required environment variable. This also requires the specified docker image to exist, either locally or in Docker Hub.

If your OS Platform cannot build a local SNAPSHOT Gremlin server through maven, it is recommended to use the latest released server version from Docker Hub (do not use GREMLIN_SERVER=latest, use actual version number, e.g. GREMLIN_SERVER=3.5.x or GREMLIN_SERVER=3.6.x).

There are 4 ways to launch the test suite and set the GREMLIN_SERVER environment variable depending on your Platform:

  • Execute tests via the run.sh script, which sets GREMLIN_SERVER by default. Run ./run.sh -h for usage information (Unix/Linux - recommended).
  • Add GREMLIN_SERVER=<server-image-version> to an .env file inside gremlin-go and run docker-compose up --exit-code-from gremlin-go-integration-tests (Platform-agnostic).
  • Run GREMLIN_SERVER=<server-image-version> docker-compose up --exit-code-from gremlin-go-integration-tests in Unix/Linux.
  • Run $env:GREMLIN_SERVER="<server-image-version>";docker-compose up --exit-code-from gremlin-go-integration-tests in Windows PowerShell.

You should see exit code 0 upon successful completion of the test suites. Run docker-compose down to remove the service containers (not needed if you executed run.sh), or docker-compose down --rmi all to remove the service containers while deleting all used images.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Barrier = barriers{
	NormSack: "normSack",
}

Barrier is any step that requires all left traversers to be processed prior to emitting result traversers to the right.

View Source
var Cardinality = cardinalities{
	Single: "single",
	List:   "list",
	Set:    "set",
}

Cardinality of Vertex Properties.

View Source
var Column = columns{
	Keys:   "keys",
	Values: "values",
}

Column references a particular type of column in a complex data structure.

View Source
var Direction = directions{
	In:   "IN",
	Out:  "OUT",
	Both: "BOTH",
}

Direction is used to denote the direction of an Edge or location of a Vertex on an Edge.

View Source
var Operator = operators{
	Sum:     "sum",
	Minus:   "minus",
	Mult:    "mult",
	Div:     "div",
	Min:     "min",
	Max:     "max",
	Assign:  "assign",
	And:     "and",
	Or:      "or",
	AddAll:  "addAll",
	SumLong: "sumLong",
}

Operator is a set of operations for traversal steps.

View Source
var Order = orders{
	Shuffle: "shuffle",
	Asc:     "asc",
	Desc:    "desc",
}

Order provides comparator instances for ordering traversers.

View Source
var Pick = picks{
	Any:  "any",
	None: "none",
}
View Source
var Pop = pops{
	First: "first",
	Last:  "last",
	All:   "all",
	Mixed: "mixed",
}

Pop is used to determine whether the first value, last value, or all values are gathered.

View Source
var Scope = scopes{
	Global: "global",
	Local:  "local",
}

Scope is used in many Step instance can have a variable scope which alter the manner in which the step will behave in relation to how the traversers are processed.

View Source
var T = ts{
	Id:    "id",
	Label: "label",
	Id_:   "id_",
	Key:   "key",
	Value: "value",
}

T is string symbols.

View Source
var WithOptions = withOptions{
	Tokens:  "~tinkerpop.valueMap.tokens",
	None:    0,
	Ids:     1,
	Labels:  2,
	Keys:    4,
	Values:  8,
	All:     1 | 2 | 4 | 8,
	Indexer: "~tinkerpop.index.indexer",
	List:    0,
	Map:     1,
}

WithOptions holds configuration options to be passed to the GraphTraversal.

Functions

This section is empty.

Types

type AnonymousTraversal

type AnonymousTraversal interface {
	// T__ creates an empty GraphTraversal.
	T__(args ...interface{}) *GraphTraversal
	// V adds the v step to the GraphTraversal.
	V(args ...interface{}) *GraphTraversal
	// AddE adds the addE step to the GraphTraversal.
	AddE(args ...interface{}) *GraphTraversal
	// AddV adds the addV step to the GraphTraversal.
	AddV(args ...interface{}) *GraphTraversal
	// Aggregate adds the aggregate step to the GraphTraversal.
	Aggregate(args ...interface{}) *GraphTraversal
	// And adds the and step to the GraphTraversal.
	And(args ...interface{}) *GraphTraversal
	// As adds the as step to the GraphTraversal.
	As(args ...interface{}) *GraphTraversal
	// Barrier adds the barrier step to the GraphTraversal.
	Barrier(args ...interface{}) *GraphTraversal
	// Both adds the both step to the GraphTraversal.
	Both(args ...interface{}) *GraphTraversal
	// BothE adds the bothE step to the GraphTraversal.
	BothE(args ...interface{}) *GraphTraversal
	// BothV adds the bothV step to the GraphTraversal.
	BothV(args ...interface{}) *GraphTraversal
	// Branch adds the branch step to the GraphTraversal.
	Branch(args ...interface{}) *GraphTraversal
	// By adds the by step to the GraphTraversal.
	By(args ...interface{}) *GraphTraversal
	// Cap adds the cap step to the GraphTraversal.
	Cap(args ...interface{}) *GraphTraversal
	// Choose adds the choose step to the GraphTraversal.
	Choose(args ...interface{}) *GraphTraversal
	// Coalesce adds the coalesce step to the GraphTraversal.
	Coalesce(args ...interface{}) *GraphTraversal
	// Coin adds the coin step to the GraphTraversal.
	Coin(args ...interface{}) *GraphTraversal
	// ConnectedComponent adds the connectedComponent step to the GraphTraversal.
	ConnectedComponent(args ...interface{}) *GraphTraversal
	// Constant adds the constant step to the GraphTraversal.
	Constant(args ...interface{}) *GraphTraversal
	// Count adds the count step to the GraphTraversal.
	Count(args ...interface{}) *GraphTraversal
	// CyclicPath adds the cyclicPath step to the GraphTraversal.
	CyclicPath(args ...interface{}) *GraphTraversal
	// Dedup adds the dedup step to the GraphTraversal.
	Dedup(args ...interface{}) *GraphTraversal
	// Drop adds the drop step to the GraphTraversal.
	Drop(args ...interface{}) *GraphTraversal
	// ElementMap adds the elementMap step to the GraphTraversal.
	ElementMap(args ...interface{}) *GraphTraversal
	// Emit adds the emit step to the GraphTraversal.
	Emit(args ...interface{}) *GraphTraversal
	// Filter adds the filter step to the GraphTraversal.
	Filter(args ...interface{}) *GraphTraversal
	// FlatMap adds the flatMap step to the GraphTraversal.
	FlatMap(args ...interface{}) *GraphTraversal
	// Fold adds the fold step to the GraphTraversal.
	Fold(args ...interface{}) *GraphTraversal
	// From adds the from step to the GraphTraversal.
	From(args ...interface{}) *GraphTraversal
	// Group adds the group step to the GraphTraversal.
	Group(args ...interface{}) *GraphTraversal
	// GroupCount adds the groupCount step to the GraphTraversal.
	GroupCount(args ...interface{}) *GraphTraversal
	// Has adds the has step to the GraphTraversal.
	Has(args ...interface{}) *GraphTraversal
	// HasId adds the hasId step to the GraphTraversal.
	HasId(args ...interface{}) *GraphTraversal
	// HasKey adds the hasKey step to the GraphTraversal.
	HasKey(args ...interface{}) *GraphTraversal
	// HasLabel adds the hasLabel step to the GraphTraversal.
	HasLabel(args ...interface{}) *GraphTraversal
	// HasNot adds the hasNot step to the GraphTraversal.
	HasNot(args ...interface{}) *GraphTraversal
	// HasValue adds the hasValue step to the GraphTraversal.
	HasValue(args ...interface{}) *GraphTraversal
	// Id adds the id step to the GraphTraversal.
	Id(args ...interface{}) *GraphTraversal
	// Identity adds the identity step to the GraphTraversal.
	Identity(args ...interface{}) *GraphTraversal
	// InE adds the inE step to the GraphTraversal.
	InE(args ...interface{}) *GraphTraversal
	// InV adds the inV step to the GraphTraversal.
	InV(args ...interface{}) *GraphTraversal
	// In adds the in step to the GraphTraversal.
	In(args ...interface{}) *GraphTraversal
	// Index adds the index step to the GraphTraversal.
	Index(args ...interface{}) *GraphTraversal
	// Inject adds the inject step to the GraphTraversal.
	Inject(args ...interface{}) *GraphTraversal
	// Is adds the is step to the GraphTraversal.
	Is(args ...interface{}) *GraphTraversal
	// Key adds the key step to the GraphTraversal.
	Key(args ...interface{}) *GraphTraversal
	// Label adds the label step to the GraphTraversal.
	Label(args ...interface{}) *GraphTraversal
	// Limit adds the limit step to the GraphTraversal.
	Limit(args ...interface{}) *GraphTraversal
	// Local adds the local step to the GraphTraversal.
	Local(args ...interface{}) *GraphTraversal
	// Loops adds the loops step to the GraphTraversal.
	Loops(args ...interface{}) *GraphTraversal
	// Map adds the map step to the GraphTraversal.
	Map(args ...interface{}) *GraphTraversal
	// Match adds the match step to the GraphTraversal.
	Match(args ...interface{}) *GraphTraversal
	// Math adds the math step to the GraphTraversal.
	Math(args ...interface{}) *GraphTraversal
	// Max adds the max step to the GraphTraversal.
	Max(args ...interface{}) *GraphTraversal
	// Mean adds the mean step to the GraphTraversal.
	Mean(args ...interface{}) *GraphTraversal
	// Min adds the min step to the GraphTraversal.
	Min(args ...interface{}) *GraphTraversal
	// None adds the none step to the GraphTraversal.
	None(args ...interface{}) *GraphTraversal
	// Not adds the not step to the GraphTraversal.
	Not(args ...interface{}) *GraphTraversal
	// Option adds the option step to the GraphTraversal.
	Option(args ...interface{}) *GraphTraversal
	// Optional adds the optional step to the GraphTraversal.
	Optional(args ...interface{}) *GraphTraversal
	// Or adds the or step to the GraphTraversal.
	Or(args ...interface{}) *GraphTraversal
	// Order adds the order step to the GraphTraversal.
	Order(args ...interface{}) *GraphTraversal
	// OtherV adds the otherV step to the GraphTraversal.
	OtherV(args ...interface{}) *GraphTraversal
	// Out adds the out step to the GraphTraversal.
	Out(args ...interface{}) *GraphTraversal
	// OutE adds the outE step to the GraphTraversal.
	OutE(args ...interface{}) *GraphTraversal
	// OutV adds the outV step to the GraphTraversal.
	OutV(args ...interface{}) *GraphTraversal
	// PageRank adds the pageRank step to the GraphTraversal.
	PageRank(args ...interface{}) *GraphTraversal
	// Path adds the path step to the GraphTraversal.
	Path(args ...interface{}) *GraphTraversal
	// PeerPressure adds the peerPressure step to the GraphTraversal.
	PeerPressure(args ...interface{}) *GraphTraversal
	// Profile adds the profile step to the GraphTraversal.
	Profile(args ...interface{}) *GraphTraversal
	// Program adds the program step to the GraphTraversal.
	Program(args ...interface{}) *GraphTraversal
	// Project adds the project step to the GraphTraversal.
	Project(args ...interface{}) *GraphTraversal
	// Properties adds the properties step to the GraphTraversal.
	Properties(args ...interface{}) *GraphTraversal
	// Property adds the property step to the GraphTraversal.
	Property(args ...interface{}) *GraphTraversal
	// PropertyMap adds the propertyMap step to the GraphTraversal.
	PropertyMap(args ...interface{}) *GraphTraversal
	// Range adds the range step to the GraphTraversal.
	Range(args ...interface{}) *GraphTraversal
	// Read adds the read step to the GraphTraversal.
	Read(args ...interface{}) *GraphTraversal
	// Repeat adds the repeat step to the GraphTraversal.
	Repeat(args ...interface{}) *GraphTraversal
	// Sack adds the sack step to the GraphTraversal.
	Sack(args ...interface{}) *GraphTraversal
	// Sample adds the sample step to the GraphTraversal.
	Sample(args ...interface{}) *GraphTraversal
	// Select adds the select step to the GraphTraversal.
	Select(args ...interface{}) *GraphTraversal
	// ShortestPath adds the shortestPath step to the GraphTraversal.
	ShortestPath(args ...interface{}) *GraphTraversal
	// SideEffect adds the sideEffect step to the GraphTraversal.
	SideEffect(args ...interface{}) *GraphTraversal
	// SimplePath adds the simplePath step to the GraphTraversal.
	SimplePath(args ...interface{}) *GraphTraversal
	// Skip adds the skip step to the GraphTraversal.
	Skip(args ...interface{}) *GraphTraversal
	// Store adds the store step to the GraphTraversal.
	Store(args ...interface{}) *GraphTraversal
	// Subgraph adds the subgraph step to the GraphTraversal.
	Subgraph(args ...interface{}) *GraphTraversal
	// Sum adds the sum step to the GraphTraversal.
	Sum(args ...interface{}) *GraphTraversal
	// Tail adds the tail step to the GraphTraversal.
	Tail(args ...interface{}) *GraphTraversal
	// TimeLimit adds the timeLimit step to the GraphTraversal.
	TimeLimit(args ...interface{}) *GraphTraversal
	// Times adds the times step to the GraphTraversal.
	Times(args ...interface{}) *GraphTraversal
	// To adds the to step to the GraphTraversal.
	To(args ...interface{}) *GraphTraversal
	// ToE adds the toE step to the GraphTraversal.
	ToE(args ...interface{}) *GraphTraversal
	// ToV adds the toV step to the GraphTraversal.
	ToV(args ...interface{}) *GraphTraversal
	// Tree adds the tree step to the GraphTraversal.
	Tree(args ...interface{}) *GraphTraversal
	// Unfold adds the unfold step to the GraphTraversal.
	Unfold(args ...interface{}) *GraphTraversal
	// Union adds the union step to the GraphTraversal.
	Union(args ...interface{}) *GraphTraversal
	// Until adds the until step to the GraphTraversal.
	Until(args ...interface{}) *GraphTraversal
	// Value adds the value step to the GraphTraversal.
	Value(args ...interface{}) *GraphTraversal
	// ValueMap adds the valueMap step to the GraphTraversal.
	ValueMap(args ...interface{}) *GraphTraversal
	// Values adds the values step to the GraphTraversal.
	Values(args ...interface{}) *GraphTraversal
	// Where adds the where step to the GraphTraversal.
	Where(args ...interface{}) *GraphTraversal
	// With adds the with step to the GraphTraversal.
	With(args ...interface{}) *GraphTraversal
	// Write adds the write step to the GraphTraversal.
	Write(args ...interface{}) *GraphTraversal
}

AnonymousTraversal interface for anonymous traversals.

var T__ AnonymousTraversal = &anonymousTraversal{
	func() *GraphTraversal {
		return NewGraphTraversal(nil, NewBytecode(nil), nil)
	},
}

type AnonymousTraversalSource

type AnonymousTraversalSource interface {
	// WithRemote used to set the DriverRemoteConnection within the AnonymousTraversalSource
	WithRemote(drc *DriverRemoteConnection) *GraphTraversalSource
}

AnonymousTraversalSource interface for generating anonymous traversals.

func Traversal_

func Traversal_() AnonymousTraversalSource

Traversal_ gets an AnonymousTraversalSource.

type AuthInfo

type AuthInfo struct {
	Header   http.Header
	Username string
	Password string
}

AuthInfo is an option struct that allows authentication information to be specified. Authentication can be provided via http.Header Header directly. Basic authentication can also be used via the BasicAuthInfo function.

func BasicAuthInfo

func BasicAuthInfo(username string, password string) *AuthInfo

BasicAuthInfo provides a way to generate AuthInfo. Enter username and password and get the AuthInfo back.

func HeaderAuthInfo

func HeaderAuthInfo(header http.Header) *AuthInfo

HeaderAuthInfo provides a way to generate AuthInfo with only Header information.

type BigDecimal

type BigDecimal struct {
	Scale         int32
	UnscaledValue big.Int
}

BigDecimal represents an arbitrary-precision signed decimal number, consisting of an arbitrary precision integer unscaled value and a 32-bit integer scale.

type Binding

type Binding struct {
	Key   string
	Value interface{}
}

Binding associates a string variable with a value

func (*Binding) String

func (b *Binding) String() string

String returns the key value binding in string format

type Bindings

type Bindings struct{}

Bindings are used to associate a variable with a value. They enable the creation of Binding, usually used with Lambda scripts to avoid continued recompilation costs. Bindings allow a remote engine to cache traversals that will be reused over and over again save that some parameterization may change. Used as g.V().Out(&Bindings{}.Of("key", value))

func (*Bindings) Of

func (*Bindings) Of(key string, value interface{}) *Binding

Of creates a Binding

type ByteBuffer

type ByteBuffer struct {
	Data []byte
}

ByteBuffer represents the GraphBinary type ByteBuffer which can be used to serialize a binary data.

type Bytecode

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

Bytecode a list of ordered instructions for traversal that can be serialized between environments and machines.

func NewBytecode

func NewBytecode(bc *Bytecode) *Bytecode

NewBytecode creates a new Bytecode to be used in traversals.

func (*Bytecode) AddSource

func (bytecode *Bytecode) AddSource(sourceName string, args ...interface{}) error

AddSource add a traversal source instruction to the bytecode.

func (*Bytecode) AddStep

func (bytecode *Bytecode) AddStep(stepName string, args ...interface{}) error

AddStep adds a traversal instruction to the bytecode

type Client

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

Client is used to connect and interact with a Gremlin-supported server.

func NewClient

func NewClient(url string, configurations ...func(settings *ClientSettings)) (*Client, error)

NewClient creates a Client and configures it with the given parameters. During creation of the Client, a connection is created, which establishes a websocket. Important note: to avoid leaking a connection, always close the Client.

func (*Client) Close

func (client *Client) Close()

Close closes the client via connection. This is idempotent due to the underlying close() methods being idempotent as well.

func (*Client) Submit

func (client *Client) Submit(traversalString string, bindings ...map[string]interface{}) (ResultSet, error)

Submit submits a Gremlin script to the server and returns a ResultSet.

type ClientSettings

type ClientSettings struct {
	TraversalSource   string
	TransporterType   TransporterType
	LogVerbosity      LogVerbosity
	Logger            Logger
	Language          language.Tag
	AuthInfo          *AuthInfo
	TlsConfig         *tls.Config
	KeepAliveInterval time.Duration
	WriteDeadline     time.Duration
	ConnectionTimeout time.Duration
	EnableCompression bool
	ReadBufferSize    int
	WriteBufferSize   int

	// Minimum amount of concurrent active traversals on a connection to trigger creation of a new connection
	NewConnectionThreshold int
	// Maximum number of concurrent connections. Default: number of runtime processors
	MaximumConcurrentConnections int
	// Initial amount of instantiated connections. Default: 1
	InitialConcurrentConnections int
}

ClientSettings is used to modify a Client's settings on initialization.

type DriverRemoteConnection

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

DriverRemoteConnection is a remote connection.

func NewDriverRemoteConnection

func NewDriverRemoteConnection(
	url string,
	configurations ...func(settings *DriverRemoteConnectionSettings)) (*DriverRemoteConnection, error)

NewDriverRemoteConnection creates a new DriverRemoteConnection. If no custom connection settings are passed in, a connection will be created with "g" as the default TraversalSource, Gorilla as the default Transporter, Info as the default LogVerbosity, a default logger struct, and English and as the default language

func (*DriverRemoteConnection) Close

func (driver *DriverRemoteConnection) Close()

Close closes the DriverRemoteConnection. Errors if any will be logged

func (*DriverRemoteConnection) CreateSession

func (driver *DriverRemoteConnection) CreateSession(sessionId ...string) (*DriverRemoteConnection, error)

CreateSession generates a new session. sessionId stores the optional UUID param. It can be used to create a session with a specific UUID.

func (*DriverRemoteConnection) GetSessionId

func (driver *DriverRemoteConnection) GetSessionId() string

func (*DriverRemoteConnection) Submit

func (driver *DriverRemoteConnection) Submit(traversalString string) (ResultSet, error)

Submit sends a string traversal to the server.

type DriverRemoteConnectionSettings

type DriverRemoteConnectionSettings struct {
	TraversalSource   string
	TransporterType   TransporterType
	LogVerbosity      LogVerbosity
	Logger            Logger
	Language          language.Tag
	AuthInfo          *AuthInfo
	TlsConfig         *tls.Config
	KeepAliveInterval time.Duration
	WriteDeadline     time.Duration
	ConnectionTimeout time.Duration
	EnableCompression bool
	ReadBufferSize    int
	WriteBufferSize   int

	// Minimum amount of concurrent active traversals on a connection to trigger creation of a new connection
	NewConnectionThreshold int
	// Maximum number of concurrent connections. Default: number of runtime processors
	MaximumConcurrentConnections int
	// Initial amount of instantiated connections. Default: 1
	InitialConcurrentConnections int
	// contains filtered or unexported fields
}

DriverRemoteConnectionSettings are used to configure the DriverRemoteConnection.

type Edge

type Edge struct {
	Element
	OutV Vertex
	InV  Vertex
}

Edge links two Vertex structs along with its Property Objects. An edge has both a direction and a Label.

func (*Edge) String

func (e *Edge) String() string

String returns the string representation of the edge.

type EdgeLabelVerificationStrategyConfig

type EdgeLabelVerificationStrategyConfig struct {
	LogWarning      bool
	ThrowExcecption bool
}

EdgeLabelVerificationStrategyConfig provides configuration options for EdgeLabelVerificationStrategy. Zeroed (unset) values are used.

type Element

type Element struct {
	Id    interface{}
	Label string
}

Element is the base structure for both Vertex and Edge. The inherited identifier must be unique to the inheriting classes.

type Graph

type Graph struct {
}

Graph is used to store the graph.

type GraphTraversal

type GraphTraversal struct {
	*Traversal
}

GraphTraversal stores a Traversal.

func NewGraphTraversal

func NewGraphTraversal(graph *Graph, bytecode *Bytecode, remote *DriverRemoteConnection) *GraphTraversal

NewGraphTraversal make a new GraphTraversal. why is this taking a non exported field as an exported function - remove or replace?

func (*GraphTraversal) AddE

func (g *GraphTraversal) AddE(args ...interface{}) *GraphTraversal

AddE adds the addE step to the GraphTraversal.

func (*GraphTraversal) AddV

func (g *GraphTraversal) AddV(args ...interface{}) *GraphTraversal

AddV adds the addV step to the GraphTraversal.

func (*GraphTraversal) Aggregate

func (g *GraphTraversal) Aggregate(args ...interface{}) *GraphTraversal

Aggregate adds the aggregate step to the GraphTraversal.

func (*GraphTraversal) And

func (g *GraphTraversal) And(args ...interface{}) *GraphTraversal

And adds the and step to the GraphTraversal.

func (*GraphTraversal) As

func (g *GraphTraversal) As(args ...interface{}) *GraphTraversal

As adds the as step to the GraphTraversal.

func (*GraphTraversal) Barrier

func (g *GraphTraversal) Barrier(args ...interface{}) *GraphTraversal

Barrier adds the barrier step to the GraphTraversal.

func (*GraphTraversal) Both

func (g *GraphTraversal) Both(args ...interface{}) *GraphTraversal

Both adds the both step to the GraphTraversal.

func (*GraphTraversal) BothE

func (g *GraphTraversal) BothE(args ...interface{}) *GraphTraversal

BothE adds the bothE step to the GraphTraversal.

func (*GraphTraversal) BothV

func (g *GraphTraversal) BothV(args ...interface{}) *GraphTraversal

BothV adds the bothV step to the GraphTraversal.

func (*GraphTraversal) Branch

func (g *GraphTraversal) Branch(args ...interface{}) *GraphTraversal

Branch adds the branch step to the GraphTraversal.

func (*GraphTraversal) By

func (g *GraphTraversal) By(args ...interface{}) *GraphTraversal

By adds the by step to the GraphTraversal.

func (*GraphTraversal) Cap

func (g *GraphTraversal) Cap(args ...interface{}) *GraphTraversal

Cap adds the cap step to the GraphTraversal.

func (*GraphTraversal) Choose

func (g *GraphTraversal) Choose(args ...interface{}) *GraphTraversal

Choose adds the choose step to the GraphTraversal.

func (*GraphTraversal) Clone

func (g *GraphTraversal) Clone() *GraphTraversal

Clone make a copy of a traversal that is reset for iteration.

func (*GraphTraversal) Coalesce

func (g *GraphTraversal) Coalesce(args ...interface{}) *GraphTraversal

Coalesce adds the coalesce step to the GraphTraversal.

func (*GraphTraversal) Coin

func (g *GraphTraversal) Coin(args ...interface{}) *GraphTraversal

Coin adds the coint step to the GraphTraversal.

func (*GraphTraversal) ConnectedComponent

func (g *GraphTraversal) ConnectedComponent(args ...interface{}) *GraphTraversal

ConnectedComponent adds the connectedComponent step to the GraphTraversal.

func (*GraphTraversal) Constant

func (g *GraphTraversal) Constant(args ...interface{}) *GraphTraversal

Constant adds the constant step to the GraphTraversal.

func (*GraphTraversal) Count

func (g *GraphTraversal) Count(args ...interface{}) *GraphTraversal

Count adds the count step to the GraphTraversal.

func (*GraphTraversal) CyclicPath

func (g *GraphTraversal) CyclicPath(args ...interface{}) *GraphTraversal

CyclicPath adds the cyclicPath step to the GraphTraversal.

func (*GraphTraversal) Dedup

func (g *GraphTraversal) Dedup(args ...interface{}) *GraphTraversal

Dedup adds the dedup step to the GraphTraversal.

func (*GraphTraversal) Drop

func (g *GraphTraversal) Drop(args ...interface{}) *GraphTraversal

Drop adds the drop step to the GraphTraversal.

func (*GraphTraversal) ElementMap

func (g *GraphTraversal) ElementMap(args ...interface{}) *GraphTraversal

ElementMap adds the elementMap step to the GraphTraversal.

func (*GraphTraversal) Emit

func (g *GraphTraversal) Emit(args ...interface{}) *GraphTraversal

Emit adds the emit step to the GraphTraversal.

func (*GraphTraversal) Filter

func (g *GraphTraversal) Filter(args ...interface{}) *GraphTraversal

Filter adds the filter step to the GraphTraversal.

func (*GraphTraversal) FlatMap

func (g *GraphTraversal) FlatMap(args ...interface{}) *GraphTraversal

FlatMap adds the flatMap step to the GraphTraversal.

func (*GraphTraversal) Fold

func (g *GraphTraversal) Fold(args ...interface{}) *GraphTraversal

Fold adds the fold step to the GraphTraversal.

func (*GraphTraversal) From

func (g *GraphTraversal) From(args ...interface{}) *GraphTraversal

From adds the from step to the GraphTraversal.

func (*GraphTraversal) Group

func (g *GraphTraversal) Group(args ...interface{}) *GraphTraversal

Group adds the group step to the GraphTraversal.

func (*GraphTraversal) GroupCount

func (g *GraphTraversal) GroupCount(args ...interface{}) *GraphTraversal

GroupCount adds the groupCount step to the GraphTraversal.

func (*GraphTraversal) Has

func (g *GraphTraversal) Has(args ...interface{}) *GraphTraversal

Has adds the has step to the GraphTraversal.

func (*GraphTraversal) HasId

func (g *GraphTraversal) HasId(args ...interface{}) *GraphTraversal

HasId adds the hasId step to the GraphTraversal.

func (*GraphTraversal) HasKey

func (g *GraphTraversal) HasKey(args ...interface{}) *GraphTraversal

HasKey adds the hasKey step to the GraphTraversal.

func (*GraphTraversal) HasLabel

func (g *GraphTraversal) HasLabel(args ...interface{}) *GraphTraversal

HasLabel adds the hasLabel step to the GraphTraversal.

func (*GraphTraversal) HasNot

func (g *GraphTraversal) HasNot(args ...interface{}) *GraphTraversal

HasNot adds the hasNot step to the GraphTraversal.

func (*GraphTraversal) HasValue

func (g *GraphTraversal) HasValue(args ...interface{}) *GraphTraversal

HasValue adds the hasValue step to the GraphTraversal.

func (*GraphTraversal) Id

func (g *GraphTraversal) Id(args ...interface{}) *GraphTraversal

Id adds the id step to the GraphTraversal.

func (*GraphTraversal) Identity

func (g *GraphTraversal) Identity(args ...interface{}) *GraphTraversal

Identity adds the identity step to the GraphTraversal.

func (*GraphTraversal) In

func (g *GraphTraversal) In(args ...interface{}) *GraphTraversal

In adds the in step to the GraphTraversal.

func (*GraphTraversal) InE

func (g *GraphTraversal) InE(args ...interface{}) *GraphTraversal

InE adds the inE step to the GraphTraversal.

func (*GraphTraversal) InV

func (g *GraphTraversal) InV(args ...interface{}) *GraphTraversal

InV adds the inV step to the GraphTraversal.

func (*GraphTraversal) Index

func (g *GraphTraversal) Index(args ...interface{}) *GraphTraversal

Index adds the index step to the GraphTraversal.

func (*GraphTraversal) Inject

func (g *GraphTraversal) Inject(args ...interface{}) *GraphTraversal

Inject adds the inject step to the GraphTraversal.

func (*GraphTraversal) Is

func (g *GraphTraversal) Is(args ...interface{}) *GraphTraversal

Is adds the is step to the GraphTraversal.

func (*GraphTraversal) Key

func (g *GraphTraversal) Key(args ...interface{}) *GraphTraversal

Key adds the key step to the GraphTraversal.

func (*GraphTraversal) Label

func (g *GraphTraversal) Label(args ...interface{}) *GraphTraversal

Label adds the label step to the GraphTraversal.

func (*GraphTraversal) Limit

func (g *GraphTraversal) Limit(args ...interface{}) *GraphTraversal

Limit adds the limit step to the GraphTraversal.

func (*GraphTraversal) Local

func (g *GraphTraversal) Local(args ...interface{}) *GraphTraversal

Local adds the local step to the GraphTraversal.

func (*GraphTraversal) Loops

func (g *GraphTraversal) Loops(args ...interface{}) *GraphTraversal

Loops adds the loops step to the GraphTraversal.

func (*GraphTraversal) Map

func (g *GraphTraversal) Map(args ...interface{}) *GraphTraversal

Map adds the map step to the GraphTraversal.

func (*GraphTraversal) Match

func (g *GraphTraversal) Match(args ...interface{}) *GraphTraversal

Match adds the match step to the GraphTraversal.

func (*GraphTraversal) Math

func (g *GraphTraversal) Math(args ...interface{}) *GraphTraversal

Math adds the math step to the GraphTraversal.

func (*GraphTraversal) Max

func (g *GraphTraversal) Max(args ...interface{}) *GraphTraversal

Max adds the max step to the GraphTraversal.

func (*GraphTraversal) Mean

func (g *GraphTraversal) Mean(args ...interface{}) *GraphTraversal

Mean adds the mean step to the GraphTraversal.

func (*GraphTraversal) Min

func (g *GraphTraversal) Min(args ...interface{}) *GraphTraversal

Min adds the min step to the GraphTraversal.

func (*GraphTraversal) None

func (g *GraphTraversal) None(args ...interface{}) *GraphTraversal

None adds the none step to the GraphTraversal.

func (*GraphTraversal) Not

func (g *GraphTraversal) Not(args ...interface{}) *GraphTraversal

Not adds the not step to the GraphTraversal.

func (*GraphTraversal) Option

func (g *GraphTraversal) Option(args ...interface{}) *GraphTraversal

Option adds the option step to the GraphTraversal.

func (*GraphTraversal) Optional

func (g *GraphTraversal) Optional(args ...interface{}) *GraphTraversal

Optional adds the optional step to the GraphTraversal.

func (*GraphTraversal) Or

func (g *GraphTraversal) Or(args ...interface{}) *GraphTraversal

Or adds the or step to the GraphTraversal.

func (*GraphTraversal) Order

func (g *GraphTraversal) Order(args ...interface{}) *GraphTraversal

Order adds the order step to the GraphTraversal.

func (*GraphTraversal) OtherV

func (g *GraphTraversal) OtherV(args ...interface{}) *GraphTraversal

OtherV adds the otherV step to the GraphTraversal.

func (*GraphTraversal) Out

func (g *GraphTraversal) Out(args ...interface{}) *GraphTraversal

Out adds the out step to the GraphTraversal.

func (*GraphTraversal) OutE

func (g *GraphTraversal) OutE(args ...interface{}) *GraphTraversal

OutE adds the outE step to the GraphTraversal.

func (*GraphTraversal) OutV

func (g *GraphTraversal) OutV(args ...interface{}) *GraphTraversal

OutV adds the outV step to the GraphTraversal.

func (*GraphTraversal) PageRank

func (g *GraphTraversal) PageRank(args ...interface{}) *GraphTraversal

PageRank adds the pageRank step to the GraphTraversal.

func (*GraphTraversal) Path

func (g *GraphTraversal) Path(args ...interface{}) *GraphTraversal

Path adds the path step to the GraphTraversal.

func (*GraphTraversal) PeerPressure

func (g *GraphTraversal) PeerPressure(args ...interface{}) *GraphTraversal

PeerPressure adds the peerPressure step to the GraphTraversal.

func (*GraphTraversal) Profile

func (g *GraphTraversal) Profile(args ...interface{}) *GraphTraversal

Profile adds the profile step to the GraphTraversal.

func (*GraphTraversal) Program

func (g *GraphTraversal) Program(args ...interface{}) *GraphTraversal

Program adds the program step to the GraphTraversal.

func (*GraphTraversal) Project

func (g *GraphTraversal) Project(args ...interface{}) *GraphTraversal

Project adds the project step to the GraphTraversal.

func (*GraphTraversal) Properties

func (g *GraphTraversal) Properties(args ...interface{}) *GraphTraversal

Properties adds the properties step to the GraphTraversal.

func (*GraphTraversal) Property

func (g *GraphTraversal) Property(args ...interface{}) *GraphTraversal

Property adds the property step to the GraphTraversal.

func (*GraphTraversal) PropertyMap

func (g *GraphTraversal) PropertyMap(args ...interface{}) *GraphTraversal

PropertyMap adds the propertyMap step to the GraphTraversal.

func (*GraphTraversal) Range

func (g *GraphTraversal) Range(args ...interface{}) *GraphTraversal

Range adds the range step to the GraphTraversal.

func (*GraphTraversal) Read

func (g *GraphTraversal) Read(args ...interface{}) *GraphTraversal

Read adds the read step to the GraphTraversal.

func (*GraphTraversal) Repeat

func (g *GraphTraversal) Repeat(args ...interface{}) *GraphTraversal

Repeat adds the repeat step to the GraphTraversal.

func (*GraphTraversal) Sack

func (g *GraphTraversal) Sack(args ...interface{}) *GraphTraversal

Sack adds the sack step to the GraphTraversal.

func (*GraphTraversal) Sample

func (g *GraphTraversal) Sample(args ...interface{}) *GraphTraversal

Sample adds the sample step to the GraphTraversal.

func (*GraphTraversal) Select

func (g *GraphTraversal) Select(args ...interface{}) *GraphTraversal

Select adds the select step to the GraphTraversal.

func (*GraphTraversal) ShortestPath

func (g *GraphTraversal) ShortestPath(args ...interface{}) *GraphTraversal

ShortestPath adds the shortestPath step to the GraphTraversal.

func (*GraphTraversal) SideEffect

func (g *GraphTraversal) SideEffect(args ...interface{}) *GraphTraversal

SideEffect adds the sideEffect step to the GraphTraversal.

func (*GraphTraversal) SimplePath

func (g *GraphTraversal) SimplePath(args ...interface{}) *GraphTraversal

SimplePath adds the simplePath step to the GraphTraversal.

func (*GraphTraversal) Skip

func (g *GraphTraversal) Skip(args ...interface{}) *GraphTraversal

Skip adds the skip step to the GraphTraversal.

func (*GraphTraversal) Store

func (g *GraphTraversal) Store(args ...interface{}) *GraphTraversal

Store adds the store step to the GraphTraversal.

func (*GraphTraversal) Subgraph

func (g *GraphTraversal) Subgraph(args ...interface{}) *GraphTraversal

Subgraph adds the subgraph step to the GraphTraversal.

func (*GraphTraversal) Sum

func (g *GraphTraversal) Sum(args ...interface{}) *GraphTraversal

Sum adds the sum step to the GraphTraversal.

func (*GraphTraversal) Tail

func (g *GraphTraversal) Tail(args ...interface{}) *GraphTraversal

Tail adds the tail step to the GraphTraversal.

func (*GraphTraversal) TimeLimit

func (g *GraphTraversal) TimeLimit(args ...interface{}) *GraphTraversal

TimeLimit adds the timeLimit step to the GraphTraversal.

func (*GraphTraversal) Times

func (g *GraphTraversal) Times(args ...interface{}) *GraphTraversal

Times adds the times step to the GraphTraversal.

func (*GraphTraversal) To

func (g *GraphTraversal) To(args ...interface{}) *GraphTraversal

To adds the to step to the GraphTraversal.

func (*GraphTraversal) ToE

func (g *GraphTraversal) ToE(args ...interface{}) *GraphTraversal

ToE adds the toE step to the GraphTraversal.

func (*GraphTraversal) ToV

func (g *GraphTraversal) ToV(args ...interface{}) *GraphTraversal

ToV adds the toV step to the GraphTraversal.

func (*GraphTraversal) Tree

func (g *GraphTraversal) Tree(args ...interface{}) *GraphTraversal

Tree adds the tree step to the GraphTraversal.

func (*GraphTraversal) Unfold

func (g *GraphTraversal) Unfold(args ...interface{}) *GraphTraversal

Unfold adds the unfold step to the GraphTraversal.

func (*GraphTraversal) Union

func (g *GraphTraversal) Union(args ...interface{}) *GraphTraversal

Union adds the union step to the GraphTraversal.

func (*GraphTraversal) Until

func (g *GraphTraversal) Until(args ...interface{}) *GraphTraversal

Until adds the until step to the GraphTraversal.

func (*GraphTraversal) V

func (g *GraphTraversal) V(args ...interface{}) *GraphTraversal

V adds the v step to the GraphTraversal.

func (*GraphTraversal) Value

func (g *GraphTraversal) Value(args ...interface{}) *GraphTraversal

Value adds the value step to the GraphTraversal.

func (*GraphTraversal) ValueMap

func (g *GraphTraversal) ValueMap(args ...interface{}) *GraphTraversal

ValueMap adds the valueMap step to the GraphTraversal.

func (*GraphTraversal) Values

func (g *GraphTraversal) Values(args ...interface{}) *GraphTraversal

Values adds the values step to the GraphTraversal.

func (*GraphTraversal) Where

func (g *GraphTraversal) Where(args ...interface{}) *GraphTraversal

Where adds the where step to the GraphTraversal.

func (*GraphTraversal) With

func (g *GraphTraversal) With(args ...interface{}) *GraphTraversal

With adds the with step to the GraphTraversal.

func (*GraphTraversal) Write

func (g *GraphTraversal) Write(args ...interface{}) *GraphTraversal

Write adds the write step to the GraphTraversal.

type GraphTraversalSource

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

GraphTraversalSource can be used to start GraphTraversal.

func NewDefaultGraphTraversalSource

func NewDefaultGraphTraversalSource() *GraphTraversalSource

NewDefaultGraphTraversalSource creates a new graph GraphTraversalSource without a graph, strategy, or existing traversal.

func NewGraphTraversalSource

func NewGraphTraversalSource(graph *Graph, remoteConnection *DriverRemoteConnection,
	traversalStrategies ...TraversalStrategy) *GraphTraversalSource

NewGraphTraversalSource creates a new GraphTraversalSource from a Graph, DriverRemoteConnection, and any TraversalStrategy. Graph and DriverRemoteConnection can be set to nil as valid default values.

func (*GraphTraversalSource) AddE

func (gts *GraphTraversalSource) AddE(args ...interface{}) *GraphTraversal

AddE adds an Edge to start the traversal.

func (*GraphTraversalSource) AddV

func (gts *GraphTraversalSource) AddV(args ...interface{}) *GraphTraversal

AddV adds a Vertex to start the traversal.

func (*GraphTraversalSource) E

func (gts *GraphTraversalSource) E(args ...interface{}) *GraphTraversal

E reads edges from the graph to start the traversal.

func (*GraphTraversalSource) GetBytecode

func (gts *GraphTraversalSource) GetBytecode() *Bytecode

GetBytecode gets the traversal Bytecode associated with this graph traversal source.

func (*GraphTraversalSource) GetGraphTraversal

func (gts *GraphTraversalSource) GetGraphTraversal() *GraphTraversal

GetGraphTraversal gets the graph traversal associated with this graph traversal source.

func (*GraphTraversalSource) Inject

func (gts *GraphTraversalSource) Inject(args ...interface{}) *GraphTraversal

Inject inserts arbitrary objects to start the traversal.

func (*GraphTraversalSource) Io

func (gts *GraphTraversalSource) Io(args ...interface{}) *GraphTraversal

Io adds the io steps to start the traversal.

func (*GraphTraversalSource) Tx

func (gts *GraphTraversalSource) Tx() *Transaction

func (*GraphTraversalSource) V

func (gts *GraphTraversalSource) V(args ...interface{}) *GraphTraversal

V reads vertices from the graph to start the traversal.

func (*GraphTraversalSource) With

func (gts *GraphTraversalSource) With(key interface{}, value interface{}) *GraphTraversalSource

With provides a configuration to a traversal in the form of a key value pair.

func (*GraphTraversalSource) WithBulk

func (gts *GraphTraversalSource) WithBulk(args ...interface{}) *GraphTraversalSource

WithBulk allows for control of bulking operations.

func (*GraphTraversalSource) WithPath

func (gts *GraphTraversalSource) WithPath(args ...interface{}) *GraphTraversalSource

WithPath adds a path to be used throughout the life of a spawned Traversal.

func (*GraphTraversalSource) WithRemote

func (gts *GraphTraversalSource) WithRemote(remoteConnection *DriverRemoteConnection) *GraphTraversalSource

WithRemote adds a remote to be used throughout the life of a spawned Traversal.

func (*GraphTraversalSource) WithSack

func (gts *GraphTraversalSource) WithSack(args ...interface{}) *GraphTraversalSource

WithSack adds a sack to be used throughout the life of a spawned Traversal.

func (*GraphTraversalSource) WithSideEffect

func (gts *GraphTraversalSource) WithSideEffect(args ...interface{}) *GraphTraversalSource

WithSideEffect adds a side effect to be used throughout the life of a spawned Traversal.

func (*GraphTraversalSource) WithStrategies

func (gts *GraphTraversalSource) WithStrategies(args ...TraversalStrategy) *GraphTraversalSource

WithStrategies adds an arbitrary collection of TraversalStrategies instances to the traversal source.

func (*GraphTraversalSource) WithoutStrategies

func (gts *GraphTraversalSource) WithoutStrategies(args ...TraversalStrategy) *GraphTraversalSource

WithoutStrategies removes an arbitrary collection of TraversalStrategies instances to the traversal source.

type GremlinType

type GremlinType struct {
	Fqcn string
}

GremlinType represents the GraphBinary type Class which can be used to serialize a class.

type HaltedTraverserStrategyConfig

type HaltedTraverserStrategyConfig struct {
	HaltedTraverserFactoryName string
}

HaltedTraverserStrategyConfig provides configuration options for HaltedTraverserStrategy. Zeroed (unset) values are ignored.

type Lambda

type Lambda struct {
	Script   string
	Language string
}

type LogVerbosity

type LogVerbosity int

LogVerbosity is an alias for valid logging verbosity levels.

const (
	// Debug verbosity will log everything, including fine details.
	Debug LogVerbosity = iota + 1
	// Info verbosity will log messages up to standard procedure flow.
	Info
	// Warning verbosity will log messages up to warnings.
	Warning
	// Error verbosity level log only error messages.
	Error
	// Off verbosity level disables logging.
	Off
)

type Logger

type Logger interface {
	Log(verbosity LogVerbosity, v ...interface{})
	Logf(verbosity LogVerbosity, format string, v ...interface{})
}

Logger is the interface required to be implemented for use with gremlingo.

type MatchAlgorithmStrategyConfig

type MatchAlgorithmStrategyConfig struct {
	MatchAlgorithm string
}

MatchAlgorithmStrategyConfig provides configuration options for MatchAlgorithmStrategy. Zeroed (unset) values are ignored.

type Metrics

type Metrics struct {
	Id   string
	Name string
	// the duration in nanoseconds.
	Duration      int64
	Counts        map[string]int64
	Annotations   map[string]interface{}
	NestedMetrics []Metrics
}

Metrics holds metrics data; typically for .profile()-step analysis. Metrics may be nested. Nesting enables the ability to capture explicit metrics for multiple distinct operations. Annotations are used to store miscellaneous notes that might be useful to a developer when examining results, such as index coverage for Steps in a Traversal.

type PartitionStrategyConfig

type PartitionStrategyConfig struct {
	PartitionKey          string
	WritePartition        string
	ReadPartitions        []string
	IncludeMetaProperties bool
}

PartitionStrategyConfig provides configuration options for PartitionStrategy. Zeroed (unset) values are ignored except IncludeMetaProperties.

type Path

type Path struct {
	Labels  []Set
	Objects []interface{}
}

Path denotes a particular walk through a Graph as defined by a traversal. A list of Labels and a list of Objects is maintained in the path. The list of Labels are the Labels of the steps traversed, and the Objects are the Objects that are traversed.

func (*Path) GetPathObject

func (p *Path) GetPathObject(key string) (interface{}, error)

GetPathObject returns the Value that corresponds to the Key for the Path and error if the Value is not present or cannot be retrieved.

func (*Path) String

func (p *Path) String() string

String returns the string representation of the path.

type Predicate

type Predicate interface {
	// Between Predicate to determine if value is within (inclusive) the range of two specified values.
	Between(args ...interface{}) Predicate
	// Eq Predicate to determine if equal to.
	Eq(args ...interface{}) Predicate
	// Gt Predicate to determine if greater than.
	Gt(args ...interface{}) Predicate
	// Gte Predicate to determine if greater than or equal to.
	Gte(args ...interface{}) Predicate
	// Inside Predicate to determine if value is within range of specified values (exclusive).
	Inside(args ...interface{}) Predicate
	// Lt Predicate to determine if less than.
	Lt(args ...interface{}) Predicate
	// Lte Predicate to determine if less than or equal to.
	Lte(args ...interface{}) Predicate
	// Neq Predicate to determine if not equal to.
	Neq(args ...interface{}) Predicate
	// Not Predicate gives the opposite of the specified Predicate.
	Not(args ...interface{}) Predicate
	// Outside Predicate to determine of value is not within range of specified values (exclusive).
	Outside(args ...interface{}) Predicate
	// Test evaluates Predicate on given argument.
	Test(args ...interface{}) Predicate
	// Within Predicate determines if value is within given list of values.
	Within(args ...interface{}) Predicate
	// Without Predicate determines if value is not within the specified.
	Without(args ...interface{}) Predicate
	// And Predicate returns a Predicate composed of two predicates (logical AND of them).
	And(args ...interface{}) Predicate
	// Or Predicate returns a Predicate composed of two predicates (logical OR of them).
	Or(args ...interface{}) Predicate
}

Predicate interface.

var P Predicate = &p{}

type ProductiveByStrategyConfig

type ProductiveByStrategyConfig struct {
	ProductiveKeys []string
}

ProductiveByStrategyConfig provides configuration options for ProductiveByStrategy. Zeroed (unset) values are used.

type Property

type Property struct {
	Key     string
	Value   interface{}
	Element Element
}

Property denotes a Key/Value pair associated with an Edge. A property can be empty.

func (*Property) String

func (p *Property) String() string

String returns the string representation of the property.

type ReservedKeysVerificationStrategyConfig

type ReservedKeysVerificationStrategyConfig struct {
	LogWarning     bool
	ThrowException bool
	Keys           []string
}

ReservedKeysVerificationStrategyConfig provides configuration options for ReservedKeysVerificationStrategy. Zeroed (unset) values are used except Keys.

type Result

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

Result Struct to abstract the Result and provide functions to use it.

func (*Result) GetBool

func (r *Result) GetBool() (bool, error)

GetBool gets the result by coercing it into a boolean, else returns an error if not parsable.

func (*Result) GetByte

func (r *Result) GetByte() (byte, error)

GetByte gets the result by coercing it into a byte (uint8), else returns an error if not parsable.

func (*Result) GetEdge

func (r *Result) GetEdge() (*Edge, error)

GetEdge returns the result if it is an edge, otherwise returns an error.

func (*Result) GetElement

func (r *Result) GetElement() (*Element, error)

GetElement returns the result if it is an Element, otherwise returns an error.

func (*Result) GetFloat32

func (r *Result) GetFloat32() (float32, error)

GetFloat32 gets the result by coercing it into a float32, else returns an error if not parsable.

func (*Result) GetFloat64

func (r *Result) GetFloat64() (float64, error)

GetFloat64 gets the result by coercing it into a float64, else returns an error if not parsable.

func (*Result) GetInt

func (r *Result) GetInt() (int, error)

GetInt gets the result by coercing it into an int, else returns an error if not parsable.

func (*Result) GetInt16

func (r *Result) GetInt16() (int16, error)

GetInt16 gets the result by coercing it into an int16, else returns an error if not parsable.

func (*Result) GetInt32

func (r *Result) GetInt32() (int32, error)

GetInt32 gets the result by coercing it into a rune(int32), else returns an error if not parsable.

func (*Result) GetInt64

func (r *Result) GetInt64() (int64, error)

GetInt64 gets the result by coercing it into an int64, else returns an error if not parsable.

func (*Result) GetInt8

func (r *Result) GetInt8() (int8, error)

GetInt8 gets the result by coercing it into an int16, else returns an error if not parsable.

func (*Result) GetInterface

func (r *Result) GetInterface() interface{}

GetInterface returns the result item.

func (*Result) GetPath

func (r *Result) GetPath() (*Path, error)

GetPath returns the result if it is a path, otherwise returns an error.

func (*Result) GetProperty

func (r *Result) GetProperty() (*Property, error)

GetProperty returns the result if it is a property, otherwise returns an error.

func (*Result) GetSlice

func (r *Result) GetSlice() (*[]interface{}, error)

GetSlice returns the Result if it is a Slice, otherwise returns an error.

func (*Result) GetString

func (r *Result) GetString() string

GetString gets the string representation of the result.

func (*Result) GetTraverser

func (r *Result) GetTraverser() (*Traverser, error)

GetTraverser returns the Result if it is a Traverser, otherwise returns an error.

func (*Result) GetType

func (r *Result) GetType() reflect.Type

GetType returns the type of the result.

func (*Result) GetUint

func (r *Result) GetUint() (uint, error)

GetUint gets the result by coercing it into an int, else returns an error if not parsable.

func (*Result) GetUint16

func (r *Result) GetUint16() (uint16, error)

GetUint16 gets the result by coercing it into an int16, else returns an error if not parsable.

func (*Result) GetUint32

func (r *Result) GetUint32() (uint32, error)

GetUint32 gets the result by coercing it into a rune(int32), else returns an error if not parsable.

func (*Result) GetUint64

func (r *Result) GetUint64() (uint64, error)

GetUint64 gets the result by coercing it into an int64, else returns an error if not parsable.

func (*Result) GetVertex

func (r *Result) GetVertex() (*Vertex, error)

GetVertex returns the result if it is a Vertex, otherwise returns an error.

func (*Result) GetVertexProperty

func (r *Result) GetVertexProperty() (*VertexProperty, error)

GetVertexProperty returns the result if it is a Vertex property, otherwise returns an error.

func (*Result) IsNil

func (r *Result) IsNil() bool

IsNil checks if the result is null.

func (*Result) String

func (r *Result) String() string

String returns the string representation of the Result struct in Go-syntax format.

type ResultSet

type ResultSet interface {
	GetAggregateTo() string

	GetStatusAttributes() map[string]interface{}
	GetRequestID() string
	IsEmpty() bool
	Close()

	Channel() chan *Result

	One() (*Result, bool, error)
	All() ([]*Result, error)
	GetError() error
	// contains filtered or unexported methods
}

ResultSet interface to define the functions of a ResultSet.

type SeedStrategyConfig

type SeedStrategyConfig struct {
	Seed int64
}

SeedStrategyConfig provides configuration options for SeedStrategy. Zeroed (unset) values are used.

type Set

type Set interface {
	// ToSlice is the only method that needs to be implemented in order for a custom Set to operate properly.
	// ToSlice must return a slice that contains all the elements of the underlying Set with no duplicates.
	ToSlice() []interface{}
}

Set describes the necessary methods that need to be implemented for Gremlin-Go to recognize for use as a Gremlin Set.

type SimpleSet

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

SimpleSet is a basic implementation of a Set for use with Gremlin-Go.

func NewSimpleSet

func NewSimpleSet(args ...interface{}) *SimpleSet

NewSimpleSet creates a new SimpleSet containing all passed in args with duplicates excluded according to Golang equality operator rules.

func (*SimpleSet) Add

func (s *SimpleSet) Add(val interface{})

Add adds an item to the SimpleSet only if it is not already a part of it.

func (*SimpleSet) Contains

func (s *SimpleSet) Contains(val interface{}) bool

Contains checks if a value is contained in the SimpleSet or not. Items are considered already contained in the set according to Golang equality operator rules.

func (*SimpleSet) Remove

func (s *SimpleSet) Remove(val interface{})

Remove removes a value from the SimpleSet if it is in the set according to Golang equality operator rules.

func (*SimpleSet) ToSlice

func (s *SimpleSet) ToSlice() []interface{}

ToSlice must return a slice that contains all the elements of the underlying Set with no duplicates.

type SubgraphStrategyConfig

type SubgraphStrategyConfig struct {
	Vertices              *GraphTraversal
	Edges                 *GraphTraversal
	VertexProperties      *GraphTraversal
	CheckAdjacentVertices interface{}
}

SubgraphStrategyConfig provides configuration options for SubgraphStrategy. Zeroed (unset) values are ignored.

type TextPredicate

type TextPredicate interface {
	// Containing TextPredicate determines if a string contains a given value.
	Containing(args ...interface{}) TextPredicate
	// EndingWith TextPredicate determines if a string ends with a given value.
	EndingWith(args ...interface{}) TextPredicate
	// NotContaining TextPredicate determines if a string does not contain a given value.
	NotContaining(args ...interface{}) TextPredicate
	// NotEndingWith TextPredicate determines if a string does not end with a given value.
	NotEndingWith(args ...interface{}) TextPredicate
	// NotStartingWith TextPredicate determines if a string does not start with a given value.
	NotStartingWith(args ...interface{}) TextPredicate
	// StartingWith TextPredicate determines if a string starts with a given value.
	StartingWith(args ...interface{}) TextPredicate
	// And TextPredicate returns a TextPredicate composed of two predicates (logical AND of them).
	And(args ...interface{}) TextPredicate
	// Or TextPredicate returns a TextPredicate composed of two predicates (logical OR of them).
	Or(args ...interface{}) TextPredicate
}
var TextP TextPredicate = &textP{}

type Transaction

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

func (*Transaction) Begin

func (t *Transaction) Begin() (*GraphTraversalSource, error)

func (*Transaction) Close

func (t *Transaction) Close() error

func (*Transaction) Commit

func (t *Transaction) Commit() error

func (*Transaction) IsOpen

func (t *Transaction) IsOpen() bool

func (*Transaction) Rollback

func (t *Transaction) Rollback() error

type TransporterType

type TransporterType int

TransporterType is an alias for valid transport protocols.

const (
	// Gorilla transport layer: github.com/gorilla/websocket
	Gorilla TransporterType = iota + 1
)

type Traversal

type Traversal struct {
	Bytecode *Bytecode
	// contains filtered or unexported fields
}

Traversal is the primary way in which graphs are processed.

func (*Traversal) GetResultSet

func (t *Traversal) GetResultSet() (ResultSet, error)

GetResultSet submits the traversal and returns the ResultSet.

func (*Traversal) HasNext

func (t *Traversal) HasNext() (bool, error)

HasNext returns true if the result is not empty.

func (*Traversal) Iterate

func (t *Traversal) Iterate() <-chan error

Iterate all the Traverser instances in the traversal.

func (*Traversal) Next

func (t *Traversal) Next() (*Result, error)

Next returns next result.

func (*Traversal) ToList

func (t *Traversal) ToList() ([]*Result, error)

ToList returns the result in a list.

func (*Traversal) ToSet

func (t *Traversal) ToSet() (map[*Result]bool, error)

ToSet returns the results in a set.

type TraversalMetrics

type TraversalMetrics struct {
	// the duration in nanoseconds.
	Duration int64
	Metrics  []Metrics
}

TraversalMetrics contains the Metrics gathered for a Traversal as the result of the .profile()-step.

type TraversalStrategy

type TraversalStrategy interface {
}

func AdjacentToIncidentStrategy

func AdjacentToIncidentStrategy() TraversalStrategy

AdjacentToIncidentStrategy looks for Vertex- and value-emitting steps followed by a CountGlobalStep and replaces the pattern with an Edge- or Property-emitting step followed by a CountGlobalStep. Furthermore, if a vertex- or value-emitting step is the last step in a .Has(traversal), .And(traversal, ...) or .Or(traversal, ...) child traversal, it is replaced by an appropriate Edge- or Property-emitting step. Performing this replacement removes situations where the more expensive trip to an adjacent Graph Element (e.g. the Vertex on the other side of an Edge) can be satisfied by trips to incident Graph Elements (e.g. just the Edge itself).

func ByModulatorOptimizationStrategy

func ByModulatorOptimizationStrategy() TraversalStrategy

ByModulatorOptimizationStrategy looks for standard traversals in By-modulators and replaces them with more optimized traversals (e.g. TokenTraversal) if possible.

func ConnectiveStrategy

func ConnectiveStrategy() TraversalStrategy

ConnectiveStrategy rewrites the binary conjunction form of a.And().b into a AndStep of And(a,b) (likewise for OrStep).

func CountStrategy

func CountStrategy() TraversalStrategy

CountStrategy optimizes any occurrence of CountGlobalStep followed by an IsStep The idea is to limit the number of incoming elements in a way that it's enough for the IsStep to decide whether it evaluates true or false. If the traversal already contains a user supplied limit, the strategy won't modify it.

func EarlyLimitStrategy

func EarlyLimitStrategy() TraversalStrategy

EarlyLimitStrategy looks for RangeGlobalSteps that can be moved further left in the traversal and thus be applied earlier. It will also try to merge multiple RangeGlobalSteps into one. If the logical consequence of one or multiple RangeGlobalSteps is an empty result, the strategy will remove as many steps as possible and add a NoneStep instead.

func EdgeLabelVerificationStrategy

func EdgeLabelVerificationStrategy(config EdgeLabelVerificationStrategyConfig) TraversalStrategy

EdgeLabelVerificationStrategy does not allow Edge traversal steps to have no label specified. Providing one or more labels is considered to be a best practice, however, TinkerPop will not force the specification of Edge labels; instead, providers or users will have to enable this strategy explicitly.

func ElementIdStrategy

func ElementIdStrategy() TraversalStrategy

ElementIdStrategy provides a degree of control over element identifier assignment as some Graphs don't provide that feature. This strategy provides for identifier assignment by enabling users to utilize Vertex and Edge indices under the hood, thus simulating that capability. By default, when an identifier is not supplied by the user, newly generated identifiers are UUID objects.

func FilterRankingStrategy

func FilterRankingStrategy() TraversalStrategy

FilterRankingStrategy reorders filter- and order-steps according to their rank. Step ranks are defined within the strategy and indicate when it is reasonable for a step to move in front of another. It will also do its best to push step labels as far "right" as possible in order to keep Traversers as small and bulkable as possible prior to the absolute need for Path-labeling.

func IdentityRemovalStrategy

func IdentityRemovalStrategy() TraversalStrategy

IdentityRemovalStrategy looks for IdentityStep instances and removes them. If the identity step is labeled, its labels are added to the previous step. If the identity step is labeled and it's the first step in the traversal, it stays.

func IncidentToAdjacentStrategy

func IncidentToAdjacentStrategy() TraversalStrategy

IncidentToAdjacentStrategy looks for .OutE().InV(), .InE().OutV() and .BothE().OtherV() and replaces these step sequences with .Out(), .In() or .Both() respectively. The strategy won't modify the traversal if:

the Edge step is labeled
the traversal contains a Path step
the traversal contains a Lambda step

func InlineFilterStrategy

func InlineFilterStrategy() TraversalStrategy

InlineFilterStrategy analyzes filter-steps with child traversals that themselves are pure filters. If the child traversals are pure filters then the wrapping parent filter is not needed and thus, the children can be "inlined". Normalizing pure filters with inlining reduces the number of variations of a filter that a graph provider may need to reason about when writing their own strategies. As a result, this strategy helps increase the likelihood that a provider's filtering optimization will succeed at re-writing the traversal.

func LambdaRestrictionStrategy

func LambdaRestrictionStrategy() TraversalStrategy

LambdaRestrictionStrategy does not allow lambdas to be used in a Traversal. The contents of a lambda cannot be analyzed/optimized and thus, reduces the ability of other traversalStrategy instances to reason about the traversal. This strategy is not activated by default. However, graph system providers may choose to make this a default strategy in order to ensure their respective strategies are better able to operate.

func LazyBarrierStrategy

func LazyBarrierStrategy() TraversalStrategy

LazyBarrierStrategy is an OLTP-only strategy that automatically inserts a NoOpBarrierStep after every FlatMapStep if neither Path-tracking nor partial Path-tracking is required, and the next step is not the traversal's last step or a barrier. NoOpBarrierSteps allow Traversers to be bulked, thus this strategy is meant to reduce memory requirements and improve the overall query performance.

func MatchAlgorithmStrategy

func MatchAlgorithmStrategy(config MatchAlgorithmStrategyConfig) TraversalStrategy

func MatchPredicateStrategy

func MatchPredicateStrategy() TraversalStrategy

MatchPredicateStrategy will fold any post-Where() step that maintains a traversal constraint into Match(). MatchStep is intelligent with traversal constraint applications and thus, can more efficiently use the constraint of WhereTraversalStep or WherePredicateStep.

func OptionsStrategy

func OptionsStrategy(options map[string]interface{}) TraversalStrategy

OptionsStrategy will not alter the Traversal. It is only a holder for configuration options associated with the Traversal meant to be accessed by steps or other classes that might have some interaction with it. It is essentially a way for users to provide Traversal level configuration options that can be used in various ways by different Graph providers.

func OrderLimitStrategy

func OrderLimitStrategy() TraversalStrategy

OrderLimitStrategy is an OLAP strategy that folds a RangeGlobalStep into a preceding OrderGlobalStep. This helps to eliminate traversers early in the traversal and can significantly reduce the amount of memory required by the OLAP execution engine.

func PartitionStrategy

func PartitionStrategy(config PartitionStrategyConfig) TraversalStrategy

PartitionStrategy partitions the Vertices, Edges and Vertex properties of a Graph into String named partitions (i.e. buckets, subgraphs, etc.). It blinds a Traversal from "seeing" specified areas of the graph. The Traversal will ignore all Graph elements not in those "read" partitions.

func PathProcessorStrategy

func PathProcessorStrategy() TraversalStrategy

PathProcessorStrategy is an OLAP strategy that does its best to turn non-local children in Where() and Select() into local children by inlining components of the non-local child. In this way, PathProcessorStrategy helps to ensure that more traversals meet the local child constraint imposed on OLAP traversals.

func PathRetractionStrategy

func PathRetractionStrategy() TraversalStrategy

PathRetractionStrategy will remove Paths from the Traversers and increase the likelihood of bulking as Path data is not required after Select('b').

func ProductiveByStrategy

func ProductiveByStrategy(config ProductiveByStrategyConfig) TraversalStrategy

ProductiveByStrategy takes an argument of By() and wraps it CoalesceStep so that the result is either the initial Traversal argument or null. In this way, the By() is always "productive". This strategy is an "optimization" but it is perhaps more of a "decoration", but it should follow ByModulatorOptimizationStrategy which features optimizations relevant to this one.

func ReadOnlyStrategy

func ReadOnlyStrategy() TraversalStrategy

ReadOnlyStrategy detects steps marked with Mutating and returns an error if one is found.

func RemoteStrategy

func RemoteStrategy(connection DriverRemoteConnection) TraversalStrategy

RemoteStrategy reconstructs a Traversal by appending a RemoteStep to its end. That step will submit the Traversal to a RemoteConnection instance which will typically send it to a remote server for execution and return results.

func RepeatUnrollStrategy

func RepeatUnrollStrategy() TraversalStrategy

RepeatUnrollStrategy is an OLTP-only strategy that unrolls any RepeatStep if it uses a constant number of loops (Times(x)) and doesn't emit intermittent elements. If any of the following 3 steps appears within the Repeat-traversal, the strategy will not be applied:

DedupGlobalStep
LoopsStep
LambdaHolder

func ReservedKeysVerificationStrategy

func ReservedKeysVerificationStrategy(config ReservedKeysVerificationStrategyConfig) TraversalStrategy

ReservedKeysVerificationStrategy detects property keys that should not be used by the traversal. A term may be reserved by a particular graph implementation or as a convention given best practices.

func SeedStrategy

func SeedStrategy(config SeedStrategyConfig) TraversalStrategy

SeedStrategy resets the specified Seed value for Seedable steps, which in turn will produce deterministic results from those steps. It is important to note that when using this strategy that it only guarantees deterministic results from a step but not from an entire Traversal. For example, if a Graph does no guarantee iteration order for g.V() then repeated runs of g.V().Coin(0.5) with this strategy will return the same number of results but not necessarily the same ones. The same problem can occur in OLAP-based Taversals where iteration order is not explicitly guaranteed. The only way to ensure completely deterministic results in that sense is to apply some form of order() in these cases.

func SubgraphStrategy

func SubgraphStrategy(config SubgraphStrategyConfig) TraversalStrategy

SubgraphStrategy provides a way to limit the view of a Traversal. By providing Traversal representations that represent a form of filtering criterion for Vertices and/or Edges, this strategy will inject that criterion into the appropriate places of a Traversal thus restricting what it Traverses and returns.

func VertexProgramStrategy

func VertexProgramStrategy(config VertexProgramStrategyConfig) TraversalStrategy

type Traverser

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

Traverser is the objects propagating through the traversal.

type Vertex

type Vertex struct {
	Element
}

Vertex contains a single Vertex which has a Label and an Id.

func (*Vertex) String

func (v *Vertex) String() string

String returns the string representation of the vertex.

type VertexProgramStrategyConfig

type VertexProgramStrategyConfig struct {
	GraphComputer string
	Workers       int
	Persist       string
	Result        string
	Vertices      *GraphTraversal
	Edges         *GraphTraversal
	Configuration map[string]interface{}
}

VertexProgramStrategyConfig provides configuration options for VertexProgramStrategy. Zeroed (unset) values are ignored.

type VertexProperty

type VertexProperty struct {
	Element
	Key    string // This is the Label of Vertex.
	Value  interface{}
	Vertex Vertex // Vertex that owns the property.
}

VertexProperty is similar to property in that it denotes a key/value pair associated with a Vertex, but is different in that it also represents an entity that is an Element and can have properties of its own.

func (*VertexProperty) String

func (vp *VertexProperty) String() string

String returns the string representation of the vertex property.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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