Documentation ¶
Overview ¶
Package data contains classes and functions to handle graph data.
Nodes ¶
Nodes are items stored in the graph. The graphNode object is the minimal implementation of the Node interface and represents a simple node. Setting a nil value to an attribute is equivalent to removing the attribute. An attribute value can be any object which can be serialized by gob.
Edges ¶
Edges are items stored in the graph. Edges connect nodes. The graphEdge object is the minimal implementation of the Edge interface and represents a simple edge. Setting a nil value to an attribute is equivalent to removing the attribute. An attribute value can be any object which can be serialized by gob.
Index ¶
Constants ¶
const EdgeEnd1Cascading = "end1cascading"
EdgeEnd1Cascading is the flag to cascade delete operations from the first end
const EdgeEnd1CascadingLast = "end1cascadinglast"
EdgeEnd1CascadingLast is a flag to indicate that cascading delete operations are only executed on the last/only edge of a kind
const EdgeEnd1Key = "end1key"
EdgeEnd1Key is the key of the first end
const EdgeEnd1Kind = "end1kind"
EdgeEnd1Kind is the kind of the first end
const EdgeEnd1Role = "end1role"
EdgeEnd1Role is the role of the first end
const EdgeEnd2Cascading = "end2cascading"
EdgeEnd2Cascading is the flag to cascade delete operations from the second end
const EdgeEnd2CascadingLast = "end2cascadinglast"
EdgeEnd2CascadingLast is a flag to indicate that cascading delete operations are only executed on the last/only edge of a kind
const EdgeEnd2Key = "end2key"
EdgeEnd2Key is the key of the second end
const EdgeEnd2Kind = "end2kind"
EdgeEnd2Kind is the kind of the second end
const EdgeEnd2Role = "end2role"
EdgeEnd2Role is the role of the second end
const NodeKey = "key"
NodeKey is the key attribute for a node
const NodeKind = "kind"
NodeKind is the kind attribute for a node
const NodeName = "name"
NodeName is the name attribute for a node
Variables ¶
This section is empty.
Functions ¶
func NodeCompare ¶
NodeCompare compares node attributes.
Types ¶
type Edge ¶
type Edge interface { Node /* End1Key returns the key of the first end of this edge. */ End1Key() string /* End1Kind returns the kind of the first end of this edge. */ End1Kind() string /* End1Role returns the role of the first end of this edge. */ End1Role() string /* End1IsCascading is a flag to indicate that delete operations from this end are cascaded to the other end. */ End1IsCascading() bool /* End1IsCascadingLast is a flag to indicate that cascading delete operations are only executed if this is the last/only edge of this kind to the other end. The flag is ignored if End1IsCascading is false. */ End1IsCascadingLast() bool /* End2Key returns the key of the second end of this edge. */ End2Key() string /* End2Kind returns the kind of the second end of this edge. */ End2Kind() string /* End2Role returns the role of the second end of this edge. */ End2Role() string /* End2IsCascading is a flag to indicate that delete operations from this end are cascaded to the other end. */ End2IsCascading() bool /* End2IsCascadingLast is a flag to indicate that cascading delete operations are only executed if this is the last/only edge of this kind to the other end. The flag is ignored if End2IsCascading is false. */ End2IsCascadingLast() bool /* Spec returns the spec for this edge from the view of a specified endpoint. A spec is always of the form: <End Role>:<Kind>:<End Role>:<Other node kind> */ Spec(key string) string /* OtherEndKey returns the key of the endpoint which is on the other side from the given key. */ OtherEndKey(key string) string /* OtherEndKind returns the kind of the endpoint which is on the other side from the given key. */ OtherEndKind(key string) string }
Edge models edges in the graph
func NewGraphEdgeFromNode ¶
NewGraphEdgeFromNode creates a new Edge instance.
type Node ¶
type Node interface { /* Key returns a potentially non human-readable unique key for this node. */ Key() string /* Name returns a human-readable name for this node. */ Name() string /* Kind returns a human-readable kind for this node. */ Kind() string /* Data returns the node data of this node. */ Data() map[string]interface{} /* Attr returns an attribute of this node. */ Attr(attr string) interface{} /* SetAttr sets an attribute of this node. Setting a nil value removes the attribute. */ SetAttr(attr string, val interface{}) /* IndexMap returns a representation of this node as a string map which can be used to provide a full-text search. */ IndexMap() map[string]string /* String returns a string representation of this node. */ String() string }
Node models nodes in the graph
func NewGraphNodeFromMap ¶
NewGraphNodeFromMap creates a new Node instance.