Documentation
¶
Overview ¶
Package create provides APOC dynamic creation functions.
This package implements all apoc.create.* functions for dynamically creating nodes and relationships in Cypher queries.
Index ¶
- func CloneSubgraph(nodes []*NodeData, rels []*RelData) ([]*NodeData, []*RelData)
- func UUID() string
- func UUIDs(count int) []string
- func VPattern(startProps map[string]interface{}, relType string, ...) (*NodeData, *RelData, *NodeData)
- type NodeData
- func AddLabels(node *NodeData, labels []string) *NodeData
- func Clone(node *NodeData) *NodeData
- func Node(labels []string, properties map[string]interface{}) *NodeData
- func Nodes(labels []string, propertiesList []map[string]interface{}) []*NodeData
- func RemoveLabels(node *NodeData, labels []string) *NodeData
- func RemoveProperties(node *NodeData, keys []string) *NodeData
- func SetProperties(node *NodeData, properties map[string]interface{}) *NodeData
- func SetProperty(node *NodeData, key string, value interface{}) *NodeData
- func VNode(labels []string, properties map[string]interface{}) *NodeData
- func VNodes(labels []string, propertiesList []map[string]interface{}) []*NodeData
- type RelData
- func Relationship(from *NodeData, relType string, properties map[string]interface{}, ...) *RelData
- func RemoveRelProperties(rel *RelData, keys []string) *RelData
- func SetRelProperties(rel *RelData, properties map[string]interface{}) *RelData
- func SetRelProperty(rel *RelData, key string, value interface{}) *RelData
- func VRelationship(from *NodeData, relType string, properties map[string]interface{}, ...) *RelData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CloneSubgraph ¶
CloneSubgraph clones a subgraph of nodes and relationships.
Example:
apoc.create.cloneSubgraph([node1, node2], [rel1])
func UUID ¶
func UUID() string
UUID generates a UUID for a node.
Example:
apoc.create.uuid() => '550e8400-e29b-41d4-a716-446655440000'
func UUIDs ¶
UUIDs generates multiple UUIDs.
Example:
apoc.create.uuids(5) => ['uuid1', 'uuid2', ...]
func VPattern ¶
func VPattern(startProps map[string]interface{}, relType string, relProps map[string]interface{}, endProps map[string]interface{}) (*NodeData, *RelData, *NodeData)
VPattern creates a virtual pattern (nodes and relationships).
Example:
apoc.create.vPattern({_labels:['Person'], name:'Alice'}, 'KNOWS', {}, {_labels:['Person'], name:'Bob'})
Types ¶
type NodeData ¶
NodeData represents a graph node result.
func AddLabels ¶
AddLabels adds labels to a node.
Example:
apoc.create.addLabels(node, ['Employee', 'Manager'])
func Clone ¶
Clone creates a copy of a node.
Example:
apoc.create.clone(node) => new node with same properties
func Node ¶
Node creates a new node with labels and properties.
Example:
apoc.create.node(['Person'], {name: 'Alice', age: 30})
func Nodes ¶
Nodes creates multiple nodes with the same labels.
Example:
apoc.create.nodes(['Person'], [{name:'Alice'}, {name:'Bob'}])
func RemoveLabels ¶
RemoveLabels removes labels from a node.
Example:
apoc.create.removeLabels(node, ['Employee'])
func RemoveProperties ¶
RemoveProperties removes properties from a node.
Example:
apoc.create.removeProperties(node, ['age', 'city'])
func SetProperties ¶
SetProperties sets multiple properties on a node.
Example:
apoc.create.setProperties(node, {age: 31, city: 'NYC'})
func SetProperty ¶
SetProperty sets a property on a node.
Example:
apoc.create.setProperty(node, 'age', 31)
type RelData ¶
type RelData struct {
ID int64
Type string
StartNode int64
EndNode int64
Properties map[string]interface{}
}
RelData represents a graph relationship result.
func Relationship ¶
func Relationship(from *NodeData, relType string, properties map[string]interface{}, to *NodeData) *RelData
Relationship creates a new relationship between nodes.
Example:
apoc.create.relationship(alice, 'KNOWS', {since: 2020}, bob)
func RemoveRelProperties ¶
RemoveRelProperties removes properties from a relationship.
Example:
apoc.create.removeRelProperties(rel, ['weight'])
func SetRelProperties ¶
SetRelProperties sets multiple properties on a relationship.
Example:
apoc.create.setRelProperties(rel, {weight: 0.8, since: 2020})
func SetRelProperty ¶
SetRelProperty sets a property on a relationship.
Example:
apoc.create.setRelProperty(rel, 'weight', 0.8)