Documentation
¶
Index ¶
- func NewGraphDB(conf Config) (gdbi.GraphDB, error)
- func ValidateSchema(schema *Schema) error
- type Config
- type Edge
- type ForeignKey
- type Graph
- func (g *Graph) AddEdge(edges []*gdbi.Edge) error
- func (g *Graph) AddVertex(vertices []*gdbi.Vertex) error
- func (g *Graph) AddVertexIndex(label string, field string) error
- func (g *Graph) BulkAdd(stream <-chan *gdbi.GraphElement) error
- func (g *Graph) BulkDel(data *gdbi.DeleteData) error
- func (g *Graph) Compiler() gdbi.Compiler
- func (g *Graph) DelEdge(key string) error
- func (g *Graph) DelVertex(key string) error
- func (g *Graph) DeleteVertexIndex(label string, field string) error
- func (g *Graph) GetEdge(key string, load bool) *gdbi.Edge
- func (g *Graph) GetEdgeList(ctx context.Context, load bool) <-chan *gdbi.Edge
- func (g *Graph) GetInChannel(ctx context.Context, reqChan chan gdbi.ElementLookup, load bool, emitNull bool, ...) chan gdbi.ElementLookup
- func (g *Graph) GetInEdgeChannel(ctx context.Context, reqChan chan gdbi.ElementLookup, load bool, emitNull bool, ...) chan gdbi.ElementLookup
- func (g *Graph) GetOutChannel(ctx context.Context, reqChan chan gdbi.ElementLookup, load bool, emitNull bool, ...) chan gdbi.ElementLookup
- func (g *Graph) GetOutEdgeChannel(ctx context.Context, reqChan chan gdbi.ElementLookup, load bool, emitNull bool, ...) chan gdbi.ElementLookup
- func (g *Graph) GetTimestamp() string
- func (g *Graph) GetVertex(key string, load bool) *gdbi.Vertex
- func (g *Graph) GetVertexChannel(ctx context.Context, reqChan chan gdbi.ElementLookup, load bool) chan gdbi.ElementLookup
- func (g *Graph) GetVertexIndexList() <-chan *gripql.IndexID
- func (g *Graph) GetVertexList(ctx context.Context, load bool) <-chan *gdbi.Vertex
- func (g *Graph) ListEdgeLabels() ([]string, error)
- func (g *Graph) ListVertexLabels() ([]string, error)
- func (g *Graph) VertexLabelScan(ctx context.Context, label string) chan string
- type GraphDB
- func (db *GraphDB) AddGraph(graph string) error
- func (db *GraphDB) BuildSchema(ctx context.Context, graph string, sampleN uint32, random bool) (*gripql.Graph, error)
- func (db *GraphDB) Close() error
- func (db *GraphDB) DeleteGraph(graph string) error
- func (db *GraphDB) Graph(graph string) (gdbi.GraphInterface, error)
- func (db *GraphDB) ListGraphs() []string
- type Schema
- func (s *Schema) GetEdge(table string) *Edge
- func (s *Schema) GetEdgeFrom(table string) *ForeignKey
- func (s *Schema) GetEdgeGid(table string) string
- func (s *Schema) GetEdgeLabel(table string) string
- func (s *Schema) GetEdgeTables(label string) []string
- func (s *Schema) GetEdgeTo(table string) *ForeignKey
- func (s *Schema) GetIncomingEdges(table string, labels []string) []*Edge
- func (s *Schema) GetOutgoingEdges(table string, labels []string) []*Edge
- func (s *Schema) GetVertex(table string) *Vertex
- func (s *Schema) GetVertexGid(table string) string
- func (s *Schema) GetVertexLabel(table string) string
- func (s *Schema) GetVertexTables(label string) []string
- type Vertex
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewGraphDB ¶
NewGraphDB creates a new GraphDB graph database interface
Types ¶
type Config ¶
type Config struct { // the driver-specific data source name, usually consisting of at least // a database name and connection information DataSourceName string // The driver name ("mysql", "postgres", etc) Driver string // The graph definitions Graphs []*Schema }
Config describes the configuration for the sql driver.
type Edge ¶
type Edge struct { Table string GidField string Label string From *ForeignKey To *ForeignKey }
Edge describes the mapping between two tables. It may also describe a relational table containing edge properties.
type ForeignKey ¶
ForeignKey describes a relation to another table
type Graph ¶
type Graph struct {
// contains filtered or unexported fields
}
Graph is the interface to a single graph
func (*Graph) AddVertexIndex ¶
AddVertexIndex add index to vertices
func (*Graph) DeleteVertexIndex ¶
DeleteVertexIndex delete index from vertices
func (*Graph) GetEdge ¶
GetEdge loads an edge given an id. It returns nil if not found Keys are expected to be of the form: <table>:<primary_key>
func (*Graph) GetEdgeList ¶
GetEdgeList produces a channel of all edges in the graph
func (*Graph) GetInChannel ¶
func (g *Graph) GetInChannel(ctx context.Context, reqChan chan gdbi.ElementLookup, load bool, emitNull bool, edgeLabels []string) chan gdbi.ElementLookup
GetInChannel process requests of vertex ids and find the connected vertices on incoming edges
func (*Graph) GetInEdgeChannel ¶
func (g *Graph) GetInEdgeChannel(ctx context.Context, reqChan chan gdbi.ElementLookup, load bool, emitNull bool, edgeLabels []string) chan gdbi.ElementLookup
GetInEdgeChannel process requests of vertex ids and find the connected incoming edges
func (*Graph) GetOutChannel ¶
func (g *Graph) GetOutChannel(ctx context.Context, reqChan chan gdbi.ElementLookup, load bool, emitNull bool, edgeLabels []string) chan gdbi.ElementLookup
GetOutChannel process requests of vertex ids and find the connected vertices on outgoing edges
func (*Graph) GetOutEdgeChannel ¶
func (g *Graph) GetOutEdgeChannel(ctx context.Context, reqChan chan gdbi.ElementLookup, load bool, emitNull bool, edgeLabels []string) chan gdbi.ElementLookup
GetOutEdgeChannel process requests of vertex ids and find the connected outgoing edges
func (*Graph) GetTimestamp ¶
GetTimestamp gets the timestamp of last update
func (*Graph) GetVertex ¶
GetVertex loads a vertex given an id. It returns a nil if not found. Keys are expected to be of the form: <table>:<primary_key>
func (*Graph) GetVertexChannel ¶
func (g *Graph) GetVertexChannel(ctx context.Context, reqChan chan gdbi.ElementLookup, load bool) chan gdbi.ElementLookup
GetVertexChannel is passed a channel of vertex ids and it produces a channel of vertices
func (*Graph) GetVertexIndexList ¶
GetVertexIndexList lists indices
func (*Graph) GetVertexList ¶
GetVertexList produces a channel of all vertices in the graph
func (*Graph) ListEdgeLabels ¶
ListEdgeLabels returns a list of edge types in the graph
func (*Graph) ListVertexLabels ¶
ListVertexLabels returns a list of vertex types in the graph
type GraphDB ¶
type GraphDB struct {
// contains filtered or unexported fields
}
GraphDB manages graphs in the database
func (*GraphDB) BuildSchema ¶
func (db *GraphDB) BuildSchema(ctx context.Context, graph string, sampleN uint32, random bool) (*gripql.Graph, error)
BuildSchema returns the schema of a specific graph in the database
func (*GraphDB) DeleteGraph ¶
DeleteGraph deletes an existing graph named `graph`
func (*GraphDB) Graph ¶
func (db *GraphDB) Graph(graph string) (gdbi.GraphInterface, error)
Graph obtains the gdbi.DBI for a particular graph
func (*GraphDB) ListGraphs ¶
ListGraphs lists the graphs managed by this driver
type Schema ¶
Schema describes the mapping of tables to the graph.
func (*Schema) GetEdgeFrom ¶
func (s *Schema) GetEdgeFrom(table string) *ForeignKey
GetEdgeFrom finds the Edge schema for the given table and returns the ForeignKey instance in From
func (*Schema) GetEdgeGid ¶
GetEdgeGid finds the Edge schema for the given table and returns the GidField
func (*Schema) GetEdgeLabel ¶
GetEdgeLabel finds the Edge schema for the given table and returns the Label
func (*Schema) GetEdgeTables ¶
GetEdgeTables searches for Edge schema with the provided label and returns an array of table names for those edges
func (*Schema) GetEdgeTo ¶
func (s *Schema) GetEdgeTo(table string) *ForeignKey
GetEdgeTo finds the Edge schema for the given table and returns the ForeignKey instance in To
func (*Schema) GetIncomingEdges ¶
GetIncomingEdges returns all Edge schema with To.DestTable matching 'table'. If one or more labels are provided only those Edges with those labels will be returned.
func (*Schema) GetOutgoingEdges ¶
GetOutgoingEdges returns all Edge schema with From.DestTable matching 'table' If one or more labels are provided only those Edges with those labels will be returned.
func (*Schema) GetVertexGid ¶
GetVertexGid finds the Vertex schema for the given table and returns the GidField
func (*Schema) GetVertexLabel ¶
GetVertexLabel finds the Vertex schema for the given table and returns the Label
func (*Schema) GetVertexTables ¶
GetVertexTables searches for Vertex schema with the provided label and returns an array of table names for those vertices