Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Document ¶
type Document struct {
Graph Graph `json:"graph"`
}
Document is the top-level container for an OpenGraph JSON file.
type Edge ¶
type Edge struct {
StartID string `json:"start_id"`
EndID string `json:"end_id"`
Kind string `json:"kind"`
Properties map[string]any `json:"properties,omitempty"`
}
Edge represents a directed relationship between two nodes.
type IDMap ¶
IDMap maps document string node IDs to their database-assigned IDs.
func Load ¶
Load reads a Document from r, validates it, and writes the graph into db. Returns a mapping from document node IDs to database IDs.
func WriteGraph ¶
WriteGraph writes the nodes and edges of g into db. Returns a mapping from document node IDs to database IDs.
func WriteGraphTx ¶
func WriteGraphTx(tx graph.Transaction, g *Graph) (IDMap, error)
WriteGraphTx writes the nodes and edges of g using an existing transaction. This is useful for creating fixture data that will be rolled back.
Click to show internal directories.
Click to hide internal directories.