Documentation ¶
Index ¶
- Constants
- func UUID() string
- type Edge
- type Export
- type Graph
- func (g *Graph) AddEdge(e *Edge) error
- func (g *Graph) AddEdges(edges ...*Edge) error
- func (g *Graph) AddNode(n Node)
- func (g *Graph) AddNodes(nodes ...Node)
- func (g *Graph) Close()
- func (g *Graph) DelEdge(id TypedID)
- func (g *Graph) DelNode(id TypedID)
- func (g *Graph) EdgeTypes() []string
- func (g *Graph) EdgesFrom(edgeType Type, id TypedID, fn func(e *Edge) bool)
- func (g *Graph) EdgesTo(edgeType Type, id TypedID, fn func(e *Edge) bool)
- func (g *Graph) Export() *Export
- func (g *Graph) GetEdge(id TypedID) (*Edge, bool)
- func (g *Graph) GetNode(id TypedID) (Node, bool)
- func (g *Graph) HasEdge(id TypedID) bool
- func (g *Graph) HasNode(id TypedID) bool
- func (g *Graph) Import(exp *Export) error
- func (g *Graph) NodeTypes() []string
- func (g *Graph) RangeEdgeTypes(edgeType Type, fn func(e *Edge) bool)
- func (g *Graph) RangeEdges(fn func(e *Edge) bool)
- func (g *Graph) RangeNodeTypes(typ Type, fn func(n Node) bool)
- func (g *Graph) RangeNodes(fn func(n Node) bool)
- type ID
- type Node
- func (m Node) Copy() Node
- func (m Node) Del(key string)
- func (v Node) Equals(other Node) bool
- func (m Node) Exists(key string) bool
- func (m Node) Filter(filter func(key string, v interface{}) bool) Node
- func (m Node) FromJSON(data []byte) error
- func (m Node) Get(key string) interface{}
- func (m Node) GetBool(key string) bool
- func (m Node) GetInt(key string) int
- func (v Node) GetNested(key string) (Node, bool)
- func (m Node) GetString(key string) string
- func (n Node) HasID() bool
- func (n Node) ID() string
- func (m Node) Intersection(other Node) Node
- func (v Node) IsNested(key string) bool
- func (v Node) JSON() ([]byte, error)
- func (m Node) Range(iterator func(key string, v interface{}) bool)
- func (n2 Node) Read(p []byte) (n int, err error)
- func (m Node) Set(k string, v interface{})
- func (m Node) SetAll(data map[string]interface{})
- func (n Node) SetID(id string)
- func (v Node) SetNested(key string, node Node)
- func (n Node) SetType(nodeType string)
- func (n Node) Type() string
- func (m Node) Union(other Node) Node
- func (n Node) Validate() error
- func (n2 Node) Write(p []byte) (n int, err error)
- type Type
- type TypedID
Constants ¶
View Source
const ( ID_KEY = "_id" TYPE_KEY = "_type" )
View Source
const AnyType = "*"
View Source
const DefaultType = "default"
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Edge ¶
type Edge struct { // An edge implements Node because it has an Identifier and attributes Node `json:"node"` // From returns the root node of the edge From Node `json:"from"` // To returns the target node of the edge To Node `json:"to"` }
Edge is a relationship between two nodes
type Graph ¶
type Graph struct {
// contains filtered or unexported fields
}
Graph is a concurrency safe, mutable, in-memory directed graph
func (*Graph) RangeEdges ¶
func (*Graph) RangeNodes ¶
type Node ¶
type Node map[string]interface{}
Node is a functional hash table for storing arbitrary data. It is not concurrency safe
func (Node) Intersection ¶
Intersection returns the node that exist in both Nodes ref: https://en.wikipedia.org/wiki/Intersection_(set_theory)#:~:text=In%20mathematics%2C%20the%20intersection%20of,that%20also%20belong%20to%20A).
func (Node) Range ¶
Range iterates over the Node with the function. If the function returns false, the iteration exits.
func (Node) Union ¶
Union returns the all node in both Nodes ref: https://en.wikipedia.org/wiki/Union_(set_theory)
Click to show internal directories.
Click to hide internal directories.