Documentation
¶
Overview ¶
Package node provides APOC node operations.
This package implements all apoc.node.* functions for working with nodes in Cypher queries.
Index ¶
- Variables
- func Connected(node1, node2 *Node, relType string) bool
- func Degree(node *Node, relType string) int
- func DegreeIn(node *Node, relType string) int
- func DegreeOut(node *Node, relType string) int
- func Diff(node1, node2 *Node) map[string]interface{}
- func Equals(node1, node2 *Node) bool
- func HasLabel(node *Node, label string) bool
- func HasLabels(node *Node, labels []string) bool
- func ID(node *Node) int64
- func IsDense(node *Node, threshold int) bool
- func Labels(node *Node) []string
- func Properties(node *Node) map[string]interface{}
- func Property(node *Node, key string) interface{}
- func RelationshipExists(node *Node, relPattern string) bool
- func RelationshipTypes(node *Node) []string
- func RelationshipTypesIn(node *Node) []string
- func RelationshipTypesOut(node *Node) []string
- func ToMap(node *Node) map[string]interface{}
- type Node
- func AddLabel(node *Node, label string) *Node
- func AddLabels(node *Node, labels []string) *Node
- func Clone(node *Node) *Node
- func FromMap(m map[string]interface{}) *Node
- func Neighbors(node *Node, relType string) []*Node
- func NeighborsIn(node *Node, relType string) []*Node
- func NeighborsOut(node *Node, relType string) []*Node
- func RemoveLabel(node *Node, label string) *Node
- func RemoveLabels(node *Node, labels []string) *Node
- func RemoveProperties(node *Node, keys []string) *Node
- func RemoveProperty(node *Node, key string) *Node
- func SetProperties(node *Node, props map[string]interface{}) *Node
- func SetProperty(node *Node, key string, value interface{}) *Node
- type Relationship
Constants ¶
This section is empty.
Variables ¶
var Storage storage.Storage = storage.NewInMemoryStorage()
Storage is the interface for database operations.
Functions ¶
func Connected ¶
Connected checks if two nodes are connected.
Example:
apoc.node.connected(node1, node2, 'KNOWS') => true
func Degree ¶
Degree returns the degree (number of relationships) of a node.
Example:
apoc.node.degree(node) => 5
func DegreeIn ¶
DegreeIn returns the in-degree of a node.
Example:
apoc.node.degree.in(node, 'KNOWS') => 3
func DegreeOut ¶
DegreeOut returns the out-degree of a node.
Example:
apoc.node.degree.out(node, 'KNOWS') => 2
func Diff ¶
Diff compares two nodes and returns differences.
Example:
apoc.node.diff(node1, node2)
=> {added:{...}, removed:{...}, changed:{...}}
func HasLabel ¶
HasLabel checks if a node has a specific label.
Example:
apoc.node.hasLabel(node, 'Person') => true
func HasLabels ¶
HasLabels checks if a node has all specified labels.
Example:
apoc.node.hasLabels(node, ['Person', 'Employee']) => true
func IsDense ¶
IsDense checks if a node is dense (many relationships).
Example:
apoc.node.isDense(node) => true
func Labels ¶
Labels returns the labels of a node.
Example:
apoc.node.labels(node) => ['Person', 'Employee']
func Properties ¶
Properties returns all properties of a node.
Example:
apoc.node.properties(node) => {name:'Alice', age:30}
func Property ¶
Property returns a specific property value.
Example:
apoc.node.property(node, 'name') => 'Alice'
func RelationshipExists ¶
RelationshipExists checks if a relationship exists.
Example:
apoc.node.relationshipExists(node, 'KNOWS>') => true
func RelationshipTypes ¶
RelationshipTypes returns all relationship types of a node.
Example:
apoc.node.relationshipTypes(node) => ['KNOWS', 'WORKS_AT']
func RelationshipTypesIn ¶
RelationshipTypesIn returns incoming relationship types.
Example:
apoc.node.relationshipTypes.in(node) => ['KNOWS', 'FOLLOWS']
func RelationshipTypesOut ¶
RelationshipTypesOut returns outgoing relationship types.
Example:
apoc.node.relationshipTypes.out(node) => ['KNOWS', 'WORKS_AT']
Types ¶
type Node ¶
Node represents a graph node.
func AddLabels ¶
AddLabels adds multiple labels to a node.
Example:
apoc.node.addLabels(node, ['Employee', 'Manager'])
func Clone ¶
Clone creates a copy of a node.
Example:
apoc.node.clone(node) => new node with same properties
func FromMap ¶
FromMap creates a node from a map.
Example:
apoc.node.fromMap({labels:['Person'], properties:{name:'Alice'}})
func Neighbors ¶
Neighbors returns neighboring nodes.
Example:
apoc.node.neighbors(node, 'KNOWS') => [node1, node2, ...]
func NeighborsIn ¶
NeighborsIn returns incoming neighbors.
Example:
apoc.node.neighbors.in(node, 'KNOWS') => [node1, node2]
func NeighborsOut ¶
NeighborsOut returns outgoing neighbors.
Example:
apoc.node.neighbors.out(node, 'KNOWS') => [node1, node2]
func RemoveLabel ¶
RemoveLabel removes a label from a node.
Example:
apoc.node.removeLabel(node, 'Employee')
func RemoveLabels ¶
RemoveLabels removes multiple labels from a node.
Example:
apoc.node.removeLabels(node, ['Employee', 'Manager'])
func RemoveProperties ¶
RemoveProperties removes multiple properties from a node.
Example:
apoc.node.removeProperties(node, ['age', 'city'])
func RemoveProperty ¶
RemoveProperty removes a property from a node.
Example:
apoc.node.removeProperty(node, 'age')
func SetProperties ¶
SetProperties sets multiple properties on a node.
Example:
apoc.node.setProperties(node, {age:31, city:'NYC'})
func SetProperty ¶
SetProperty sets a property on a node.
Example:
apoc.node.setProperty(node, 'age', 31)
type Relationship ¶
type Relationship = storage.Relationship
Relationship represents a graph relationship.
func Relationships ¶
func Relationships(node *Node, relType string) []*Relationship
Relationships returns all relationships of a node.
Example:
apoc.node.relationships(node) => [rel1, rel2, ...]
func RelationshipsIn ¶
func RelationshipsIn(node *Node, relType string) []*Relationship
RelationshipsIn returns incoming relationships.
Example:
apoc.node.relationships.in(node, 'KNOWS') => [rel1, rel2]
func RelationshipsOut ¶
func RelationshipsOut(node *Node, relType string) []*Relationship
RelationshipsOut returns outgoing relationships.
Example:
apoc.node.relationships.out(node, 'KNOWS') => [rel1, rel2]