quick

package
v1.2.4 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package quick is used for when you want to execute queries to the graph database without having to use a Grammes client.

Although more convenient at times; this package does perform slower than the typical Grammes client due to the extra checks each function needs to do for checking if it has a client to the given connection address.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddAPIVertex

func AddAPIVertex(host string, data grammes.APIData) (grammes.Vertex, error)

AddAPIVertex will add a vertex to the graph belonging to the given host with the API object. This API object can be used like a normal vertex in case you'd rather make a vertex through a structured format rather than a gremlin command.

func AddEdgeLabel

func AddEdgeLabel(multi multiplicity.Multiplicity, host, label string) (interface{}, error)

AddEdgeLabel adds the edge label to the graph directly. This method returns the schema id of the edge label added.

func AddEdgeLabels

func AddEdgeLabels(host string, multiplicityAndLabels ...interface{}) ([]interface{}, error)

AddEdgeLabels does the same thing as AddEdgeLabel but with the ability to do multiple labels at a time. This function is called similarly to your favorite logger.

func AddPropertyKey

func AddPropertyKey(host, propertyName string, datatype datatype.DataType, cardinality cardinality.Cardinality) (interface{}, error)

AddPropertyKey adds the edge label to the graph directly. This method returns the schema id of the edge label added.

func AddVertex

func AddVertex(host, label string, properties ...interface{}) (grammes.Vertex, error)

AddVertex will add a vertex label to the graph that is associated with the given host.

func AddVertexByQuery

func AddVertexByQuery(host string, q query.Query) (grammes.Vertex, error)

AddVertexByQuery takes a query and returns an added Vertex by turning it into a string.

func AddVertexByStruct

func AddVertexByStruct(host string, vertex grammes.Vertex) (grammes.Vertex, error)

AddVertexByStruct will take a Vertex struct and create a new vertex out of it in the Gremlin server. The only exception is that you cannot manually set the ID.

func AddVertexLabels

func AddVertexLabels(host string, labels ...string) ([]grammes.Vertex, error)

AddVertexLabels will do the same as AddVertexLabel, but with the ability to add multiple labels at a time.

func AllVertices

func AllVertices(host string) ([]grammes.Vertex, error)

AllVertices will query the gremlin server for all of the vertices on the graph and store them into a structured format for an easier way to interact with the data.

func CommitSchema

func CommitSchema(host string) ([][]byte, error)

CommitSchema will take all of your schema changes and apply them to the schema once they are ready.

func CustomTraversal

func CustomTraversal(q string) traversal.String

CustomTraversal is have a custom prefix for your traversal.

func DropAll

func DropAll(host string) error

DropAll drops everything from the graph.

func DropVertexByID

func DropVertexByID(host string, ids ...interface{}) error

DropVertexByID will search for vertices with the provided IDs and drop them if such vertices exist.

func DropVertexLabel

func DropVertexLabel(host, label string) error

DropVertexLabel will search for a vertex with the provided label and drop it if such a vertex exists.

func DropVerticesByQuery

func DropVerticesByQuery(host string, q query.Query) error

DropVerticesByQuery will consume the given query and drop the corresponding vertices.

func ExecuteQuery

func ExecuteQuery(host string, query query.Query) ([][]byte, error)

ExecuteQuery is used to execute a query to a gremlin server without having a client already created. For example you can use this if you are making quick small changes across multiple packages.

func ExecuteStringQuery

func ExecuteStringQuery(host, query string) ([][]byte, error)

ExecuteStringQuery is used to execute a query via a string to a gremlin server without have a client already created. For example this can be used if you are altering a graph through various packages.

func SetLogger

func SetLogger(newLogger logging.Logger)

SetLogger will replace the function used to log the queries being executed in the quick package.

func SetVertexProperty

func SetVertexProperty(host string, id interface{}, properties ...interface{}) error

SetVertexProperty will search the graph for a vertex with the given ID and set the properties provided.

func Traversal

func Traversal() traversal.String

Traversal is the main graph traversing object. This has every step you will need in a shorter format.

func VerboseTraversal

func VerboseTraversal() graph.String

VerboseTraversal is used for when you need to access the schema or verbose functions when adding vertices.

func VertexByID

func VertexByID(host string, id interface{}) (grammes.Vertex, error)

VertexByID will get a Vertex with the following ID assigned to it. This ID is unique to every vertex on the graph. This is the best way of finding vertices without any conflicting labels or properties.

func VertexCount

func VertexCount(host string) (int64, error)

VertexCount retrieves the number of vertices that are currently on the graph as an int64.

func VertexIDs

func VertexIDs(host, label string, properties ...interface{}) ([]interface{}, error)

VertexIDs takes the label and optional properties to retrieve the IDs desired from the graph.

func VertexIDsByQuery

func VertexIDsByQuery(host string, q query.Query) ([]interface{}, error)

VertexIDsByQuery will take a query and execute it. Then it will run through and extract all the vertex IDs matching the traversal and return them in an array.

func Vertices

func Vertices(host, label string, properties ...interface{}) ([]grammes.Vertex, error)

Vertices will gather any vertices and return them based on the fed in traversal.

func VerticesByQuery

func VerticesByQuery(host string, q query.Query) ([]grammes.Vertex, error)

VerticesByQuery will gather any vertices and return them based on the fed in traversal query.

Types

This section is empty.

Jump to

Keyboard shortcuts

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