Documentation ¶
Index ¶
- func AddMongoGraph(client *mgo.Client, database string, graph string) error
- func GetEdgeCollection(session *mgo.Client, database string, graph string) *mgo.Collection
- func GetVertexCollection(session *mgo.Client, database string, graph string) *mgo.Collection
- func NewCompiler(db *Graph) gdbi.Compiler
- func NewGraphDB(conf Config) (gdbi.GraphDB, error)
- func PackEdge(e *gdbi.Edge) map[string]interface{}
- func PackVertex(v *gdbi.Vertex) map[string]interface{}
- func UnpackEdge(i map[string]interface{}) *gdbi.Edge
- func UnpackVertex(i map[string]interface{}) *gdbi.Vertex
- type Compiler
- type Config
- type Graph
- func (mg *Graph) AddEdge(edges []*gdbi.Edge) error
- func (mg *Graph) AddVertex(vertices []*gdbi.Vertex) error
- func (mg *Graph) AddVertexIndex(label string, field string) error
- func (mg *Graph) BulkAdd(stream <-chan *gdbi.GraphElement) error
- func (mg *Graph) Compiler() gdbi.Compiler
- func (mg *Graph) DelEdge(key string) error
- func (mg *Graph) DelVertex(key string) error
- func (mg *Graph) DeleteVertexIndex(label string, field string) error
- func (mg *Graph) GetEdge(id string, load bool) *gdbi.Edge
- func (mg *Graph) GetEdgeList(ctx context.Context, loadProp bool) <-chan *gdbi.Edge
- func (mg *Graph) GetInChannel(ctx context.Context, reqChan chan gdbi.ElementLookup, load bool, emitNull bool, ...) chan gdbi.ElementLookup
- func (mg *Graph) GetInEdgeChannel(ctx context.Context, reqChan chan gdbi.ElementLookup, load bool, emitNull bool, ...) chan gdbi.ElementLookup
- func (mg *Graph) GetOutChannel(ctx context.Context, reqChan chan gdbi.ElementLookup, load bool, emitNull bool, ...) chan gdbi.ElementLookup
- func (mg *Graph) GetOutEdgeChannel(ctx context.Context, reqChan chan gdbi.ElementLookup, load bool, emitNull bool, ...) chan gdbi.ElementLookup
- func (mg *Graph) GetTimestamp() string
- func (mg *Graph) GetVertex(id string, load bool) *gdbi.Vertex
- func (mg *Graph) GetVertexChannel(ctx context.Context, ids chan gdbi.ElementLookup, load bool) chan gdbi.ElementLookup
- func (mg *Graph) GetVertexIndexList() <-chan *gripql.IndexID
- func (mg *Graph) GetVertexList(ctx context.Context, load bool) <-chan *gdbi.Vertex
- func (mg *Graph) ListEdgeLabels() ([]string, error)
- func (mg *Graph) ListVertexLabels() ([]string, error)
- func (mg *Graph) VertexLabelScan(ctx context.Context, label string) chan string
- type GraphDB
- func (ma *GraphDB) AddGraph(graph string) error
- func (ma *GraphDB) BuildSchema(ctx context.Context, graph string, sampleN uint32, random bool) (*gripql.Graph, error)
- func (ma *GraphDB) Close() error
- func (ma *GraphDB) DeleteGraph(graph string) error
- func (ma *GraphDB) EdgeCollection(graph string) *mongo.Collection
- func (ma *GraphDB) Graph(graph string) (gdbi.GraphInterface, error)
- func (ma *GraphDB) ListGraphs() []string
- func (ma *GraphDB) VertexCollection(graph string) *mongo.Collection
- type Pipeline
- type Processor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetEdgeCollection ¶
func GetVertexCollection ¶
func NewCompiler ¶
NewCompiler creates a new compiler that runs using the provided GraphInterface
func NewGraphDB ¶
NewGraphDB creates a new mongo graph database interface
func PackVertex ¶
PackVertex take a GRIP vertex and convert it to a mongo doc
func UnpackEdge ¶
UnpackEdge takes a mongo doc and convertes it into an gripql.Edge
func UnpackVertex ¶
UnpackVertex takes a mongo doc and converts it into an gripql.Vertex
Types ¶
type Compiler ¶
type Compiler struct {
// contains filtered or unexported fields
}
Compiler is a mongo specific compiler that works with default graph interface
func (*Compiler) Compile ¶
func (comp *Compiler) Compile(stmts []*gripql.GraphStatement, opts *gdbi.CompileOptions) (gdbi.Pipeline, error)
Compile compiles a set of graph traversal statements into a mongo aggregation pipeline
type Config ¶
type Config struct { URL string DBName string Username string Password string BatchSize int UseCorePipeline bool }
Config describes the configuration for the mongodb driver.
func (*Config) SetDefaults ¶
func (c *Config) SetDefaults()
type Graph ¶
type Graph struct {
// contains filtered or unexported fields
}
Graph is the interface to a single graph
func (*Graph) AddEdge ¶
AddEdge adds an edge to the graph, if it already exists in the graph, it is replaced
func (*Graph) AddVertex ¶
AddVertex adds an edge to the graph, if it already exists in the graph, it is replaced
func (*Graph) AddVertexIndex ¶
AddVertexIndex add index to vertices
func (*Graph) DeleteVertexIndex ¶
DeleteVertexIndex delete index from vertices
func (*Graph) GetEdgeList ¶
GetEdgeList produces a channel of all edges in the graph
func (*Graph) GetInChannel ¶
func (mg *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 (mg *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 (mg *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 (mg *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) GetVertexChannel ¶
func (mg *Graph) GetVertexChannel(ctx context.Context, ids 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 is the base driver that manages multiple graphs in mongo
func (*GraphDB) BuildSchema ¶
func (ma *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 `graph`
func (*GraphDB) EdgeCollection ¶
func (ma *GraphDB) EdgeCollection(graph string) *mongo.Collection
EdgeCollection returns a *mgo.Collection
func (*GraphDB) Graph ¶
func (ma *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
func (*GraphDB) VertexCollection ¶
func (ma *GraphDB) VertexCollection(graph string) *mongo.Collection
VertexCollection returns a *mgo.Collection
type Pipeline ¶
type Pipeline struct {
// contains filtered or unexported fields
}
Pipeline a set of runnable query operations
func (*Pipeline) Graph ¶
func (pipe *Pipeline) Graph() gdbi.GraphInterface
Graph gets the graph interface
func (*Pipeline) Processors ¶
Processors gets the list of processors