Documentation ¶
Index ¶
- Constants
- func NewProperties(kv ...KV) map[string][]byte
- type Edge
- type FilterType
- type Graph
- func (g *Graph) AddEdge(uid, sourceUID, label, targetUID string, kv ...KV) (Edge, error)
- func (g *Graph) AddNode(uid, label string, kv ...KV) (Node, error)
- func (g *Graph) Edge(uid string) (Edge, error)
- func (g *Graph) EdgeCount() int
- func (g *Graph) Edges() Iterator
- func (g *Graph) EdgesBy(source string, labels []string, target string, props map[string][]byte) Iterator
- func (g *Graph) HasEdge(uid string) bool
- func (g *Graph) HasNode(uid string) bool
- func (g *Graph) MarshalJSON() ([]byte, error)
- func (g *Graph) Node(uid string) (Node, error)
- func (g *Graph) NodeCount() int
- func (g *Graph) Nodes() Iterator
- func (g *Graph) NodesBy(labels []string, props map[string][]byte) Iterator
- func (g *Graph) Query(query string) (*Graph, error)
- func (g *Graph) RemoveEdge(uid string) error
- func (g *Graph) RemoveNode(uid string) error
- func (g *Graph) Stats() Stat
- func (g *Graph) SubGraph(uid string, levels int) (*Graph, error)
- func (g *Graph) UnmarshalJSON(b []byte) error
- func (g *Graph) UpdateEdge(edge Edge) (Edge, error)
- func (g *Graph) UpdateNode(node Node) (Node, error)
- type ItemType
- type Iterator
- type KV
- type Node
- type Stat
Constants ¶
const (
// Unlimited is used when returning a unlimited level subgraph.
Unlimited = 0
)
Variables ¶
This section is empty.
Functions ¶
func NewProperties ¶
NewProperties takes one or more key value pairs and returns a property map.
Types ¶
type Edge ¶
type Edge struct { UID string `json:"uid"` SourceUID string `json:"source_uid"` Label string `json:"label"` TargetUID string `json:"target_uid"` Properties map[string][]byte `json:"properties"` }
Edge is a edge in the graph.
type FilterType ¶
type FilterType int
FilterType indicates what to apply the filtering on.
const ( // LABEL is used for filtering by label. LABEL FilterType = iota // PROPERTY is used for filtering on properties. PROPERTY )
type Graph ¶
type Graph struct {
// contains filtered or unexported fields
}
Graph is a graph store.
func NewFromJSON ¶
NewFromJSON takes a JSON formatted output and returns a new Graph.
func (*Graph) EdgesBy ¶
func (g *Graph) EdgesBy(source string, labels []string, target string, props map[string][]byte) Iterator
EdgesBy returns a edge iterator with filtered edges. If labels is an empty list, then any label will be used. If props is an empty map, no properties will be used for filtering.
func (*Graph) MarshalJSON ¶
MarshalJSON marchals the graph into a JSON format.
func (*Graph) NodesBy ¶
NodesBy returns a node iterator with filtered nodes. If labels is an empty list, then any label will be used. If props is an empty map, no properties will be used for filtering.
func (*Graph) Query ¶
Query takes a query string and returns a subgraph containing the query results.
func (*Graph) RemoveEdge ¶
RemoveEdge removes the edge from the graph.
func (*Graph) RemoveNode ¶
RemoveNode removes the node from the graph.
func (*Graph) SubGraph ¶
SubGraph takes a starting node UID and returns a new subgraph with `n` levels deep. Levels `0` or `Unlimited` will return the subgraph with no level limit.
func (*Graph) UnmarshalJSON ¶
UnmarshalJSON unmarshals JSON data into the graph.
func (*Graph) UpdateEdge ¶
UpdateEdge updates the graph edge with the new edge.
type Iterator ¶
type Iterator interface { // Value returns the Item. Value() interface{} // Next progresses the iterator and return true if there are still items to iterate over. Next() bool // Size returns the total item count in the iterator Size() int // Channel returns the items in the iterator as a channel. Channel() <-chan interface{} }
Iterator is an iterator interface for iterating over a set of items.
type Node ¶
type Node struct { UID string `json:"uid"` Label string `json:"label"` Properties map[string][]byte `json:"properties"` // contains filtered or unexported fields }
Node is a node in the graph.