Documentation
¶
Overview ¶
Package model holds structs of the Gremlin counterparts and related methods.
These structs can be used as an unmarshalled version of a graph database's copy on the graph itself. With these structures you can alter their graph counter-part rather than creating manual graph traversals.
Index ¶
- type APIData
- type Data
- type DataMap
- type Edge
- func (e *Edge) ID() interface{}
- func (e *Edge) InVertexID() interface{}
- func (e *Edge) InVertexLabel() string
- func (e *Edge) Label() string
- func (e *Edge) OutVertexID() interface{}
- func (e *Edge) OutVertexLabel() string
- func (e *Edge) PropertyValue(key string) interface{}
- func (e *Edge) QueryInVertex(client queryClient) (Vertex, error)
- func (e *Edge) QueryOutVertex(client queryClient) (Vertex, error)
- type EdgeList
- type EdgeProperties
- type EdgePropertyDetails
- type EdgePropertyValue
- type EdgeValue
- type IDList
- type List
- type Property
- type PropertyDetailedValue
- type PropertyID
- type PropertyList
- type PropertyMap
- type PropertyValue
- type SimpleValue
- type ValueWrapper
- type Vertex
- func (v *Vertex) AddEdge(client queryClient, label string, outVID interface{}, ...) (Edge, error)
- func (v *Vertex) AddProperty(client queryClient, key string, value interface{}) error
- func (v *Vertex) Drop(client queryClient) error
- func (v *Vertex) DropProperties(client queryClient, properties ...string) error
- func (v *Vertex) ID() interface{}
- func (v *Vertex) Label() string
- func (v *Vertex) PropertyMap() PropertyMap
- func (v *Vertex) PropertyValue(key string, index int) interface{}
- func (v *Vertex) QueryBothEdges(client queryClient, labels ...string) ([]Edge, error)
- func (v *Vertex) QueryInEdges(client queryClient, labels ...string) ([]Edge, error)
- func (v *Vertex) QueryOutEdges(client queryClient, labels ...string) ([]Edge, error)
- func (v *Vertex) QueryRefresh(client queryClient) error
- func (v *Vertex) Traversal() traversal.String
- type VertexList
- type VertexValue
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIData ¶
type APIData struct { Label string `json:"dbName"` Vertex string `json:"tableName"` Properties map[string]string `json:"cols"` }
APIData holds the request in which you can make a query with using the Grammes library.
type Data ¶
type Data struct { DBName string `json:"dbName"` TableName string `json:"tableName"` Columns []DataMap `json:"columns"` }
Data holds basic information such as the label, name, ID, and properties of what this is being associated with.
type Edge ¶
Edge is the object that builds a connection between two or more vertices.
Tinkerpop: http://tinkerpop.apache.org/javadocs/3.2.1/core/org/apache/tinkerpop/gremlin/structure/Edge.html
outVertex ---label---> inVertex.
func UnmarshalEdgeList ¶
UnmarshalEdgeList is a utility to unmarshal a list or array of edges properly.
func (*Edge) InVertexID ¶
func (e *Edge) InVertexID() interface{}
InVertexID will retrieve the id for the vertex that the edge goes into.
func (*Edge) InVertexLabel ¶
InVertexLabel will retrieve the label for the vertex the edge goes into.
func (*Edge) OutVertexID ¶
func (e *Edge) OutVertexID() interface{}
OutVertexID will retrieve the id for the vertex that the edge goes out of.
func (*Edge) OutVertexLabel ¶
OutVertexLabel will retrieve the label for the vertex the edge goes out of.
func (*Edge) PropertyValue ¶
PropertyValue will retrieve the Property for you.
func (*Edge) QueryInVertex ¶
QueryInVertex will retrieve the vertex that the edge comes out of.
func (*Edge) QueryOutVertex ¶
QueryOutVertex will retrieve the vertex that the edge comes out of.
type EdgeList ¶
type EdgeList struct { Edges []Edge // contains filtered or unexported fields }
EdgeList is used for unmarshalling after querying. We use this instead of []Edge for Gremlin v3.0 compatibility.
func (*EdgeList) UnmarshalJSON ¶
UnmarshalJSON overrides to assure a proper unmarshal.
type EdgeProperties ¶
type EdgeProperties map[string]EdgePropertyDetails
EdgeProperties need to be different than Vertex ones because they're not an array/slice. It's only a map of keys and values.
type EdgePropertyDetails ¶
type EdgePropertyDetails struct { Type string `json:"@type"` Value EdgePropertyValue `json:"@value"` }
EdgePropertyDetails contains the details and meta data about the property itself.
type EdgePropertyValue ¶
type EdgePropertyValue struct { Key string `json:"key"` Value ValueWrapper `json:"value"` }
EdgePropertyValue will hold the actual value and key for the property.
type EdgeValue ¶
type EdgeValue struct { ID interface{} `json:"id"` Label string `json:"label"` InVLabel string `json:"inVLabel,omitempty"` OutVLabel string `json:"outVLabel,omitempty"` InV interface{} `json:"inV,omitempty"` OutV interface{} `json:"outV,omitempty"` Properties EdgeProperties `json:"properties,omitempty"` }
EdgeValue contains the 'value' data from the Edge object.
type IDList ¶
type IDList struct { IDs []interface{} // contains filtered or unexported fields }
IDList is used for unmarshalling after querying. We use this instead of []ID for Gremlin v3.0 compatibility.
func (*IDList) UnmarshalJSON ¶
UnmarshalJSON overrides to assure a proper unmarshal.
type List ¶
type List struct { Type string `json:"@type"` Value []interface{} `json:"@value"` }
List is used in Gremlin v3.0+ instead of arrays in some cases.
type Property ¶
type Property struct { // Type is the Gremlin-type. For this particular // structure it typically will be "g:VertexProperty" Type string `json:"@type"` // Value stores the actual data of the Property. // This would be its Key, Value, and ID. Value PropertyValue `json:"@value"` }
Property holds the type and value of the property. It's extra information used by PropertyDetail.
func NewProperty ¶
NewProperty will just shorten the struggle of filling a property struct. This is meant to be used when creating a Vertex struct.
func UnmarshalPropertyList ¶
UnmarshalPropertyList is a utility to unmarshal a list or array of IDs properly.
type PropertyDetailedValue ¶
type PropertyDetailedValue struct { Value interface{} `json:"@value"` Type string `json:"@type,omitempty"` }
PropertyDetailedValue holds the value and optional type depending on how the whole struct can unmarshal into a string or not. If not then the type is listed.
type PropertyID ¶
type PropertyID struct { Type string `json:"@type"` Value interface{} `json:"@value"` }
PropertyID holds the ID that is used for the property itself.
type PropertyList ¶
type PropertyList struct { Properties []Property // contains filtered or unexported fields }
PropertyList is used for unmarshalling after querying. We use this instead of []Edge for Gremlin v3.0 compatibility.
func (*PropertyList) UnmarshalJSON ¶
func (l *PropertyList) UnmarshalJSON(data []byte) error
UnmarshalJSON overrides to assure a proper unmarshal.
type PropertyMap ¶
PropertyMap is the map used to hold the properties itself. the string key is equivalent to the Gremlin key and the []Property is the value. Properties can have multiple values; this is why we must have it as a slice of Property.
type PropertyValue ¶
type PropertyValue struct { ID PropertyID `json:"id"` Value ValueWrapper `json:"value"` Label string `json:"label"` }
PropertyValue contains the ID, value, and label of this property's value.
type SimpleValue ¶
type SimpleValue struct { Type string `json:"@type"` Value interface{} `json:"@value"` }
SimpleValue is used to unmarshal simple value responses from the TinkerPop server. These can include simple datatypes like Int, String, Double, Bool, etc.
type ValueWrapper ¶
type ValueWrapper struct { PropertyDetailedValue Partial bool `json:"-"` }
ValueWrapper will handle storing the correct value into the correct spot in this struct for not confusion.
func (*ValueWrapper) UnmarshalJSON ¶
func (w *ValueWrapper) UnmarshalJSON(data []byte) error
UnmarshalJSON will override the unmarshal process of ValueWrapper and store the correct Value into the variables within the struct.
type Vertex ¶
type Vertex struct { Type string `json:"@type"` Value VertexValue `json:"@value"` }
Vertex maintains pointers to both a set of incoming and outgoing Edge objects. The outgoing edges are the edges for which the Vertex is a tail. The incoming edges are those edges for which the Vertex is the head.
TinkerPop: http://tinkerpop.apache.org/javadocs/3.2.1/core/org/apache/tinkerpop/gremlin/structure/Vertex.html
---inEdges---> vertex ---outEdges--->.
func UnmarshalVertexList ¶
UnmarshalVertexList is a utility to unmarshal a list or array of vertices properly.
func (*Vertex) AddEdge ¶
func (v *Vertex) AddEdge(client queryClient, label string, outVID interface{}, properties ...interface{}) (Edge, error)
AddEdge adds an outgoing edge from this Vertex object to another Vertex object via its unique ID.
func (*Vertex) AddProperty ¶
AddProperty will add a property to the vertex in the graph and return a new version of the vertex with the property added to it in the structure.
func (*Vertex) DropProperties ¶
DropProperties drops the properties from the vertex so they don't exist.
func (*Vertex) ID ¶
func (v *Vertex) ID() interface{}
ID will retrieve the Vertex ID for you without having to traverse all the way through the structures.
func (*Vertex) Label ¶
Label retrieves the label of the vertex without having to traverse all the wya through the structures.
func (*Vertex) PropertyMap ¶
func (v *Vertex) PropertyMap() PropertyMap
PropertyMap returns a copy of the properties in a map within the Vertex itself. Altering this copy will not affect the vertex on the graph.
func (*Vertex) PropertyValue ¶
PropertyValue returns the value of a property without having to traverse all the way through the structures.
func (*Vertex) QueryBothEdges ¶
QueryBothEdges will execute bothE() on this vertex for you without having to make another lengthy call to ExecuteQuery.
func (*Vertex) QueryInEdges ¶
QueryInEdges will execute inE() on this vertex for you without having to make another lengthy call to ExecuteQuery.
func (*Vertex) QueryOutEdges ¶
QueryOutEdges will execute outE() on this vertex for you without having to make another lengthy call to ExecuteQuery.
func (*Vertex) QueryRefresh ¶
QueryRefresh gets the vertex from the graph and refreshes its values to match.
type VertexList ¶
type VertexList struct { Vertices []Vertex // contains filtered or unexported fields }
VertexList is used for unmarshalling after querying. We use this instead of []Vertex for Gremlin v3.0 compatibility.
func (*VertexList) UnmarshalJSON ¶
func (l *VertexList) UnmarshalJSON(data []byte) error
UnmarshalJSON overrides to assure a proper unmarshal.
type VertexValue ¶
type VertexValue struct { ID interface{} `json:"id"` Label string `json:"label"` Properties PropertyMap `json:"properties,omitempty"` }
VertexValue contains the 'value' data from the Vertex object.