elastic

package
v0.0.0-...-fa720cf Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 2, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewGraphDB

func NewGraphDB(conf Config) (gdbi.GraphDB, error)

NewGraphDB creates a new elasticsearch graph database interface

func PackEdge

func PackEdge(e *gdbi.Edge) map[string]interface{}

PackEdge takes a AQL edge and converts it to a mongo doc

func PackVertex

func PackVertex(v *gdbi.Vertex) map[string]interface{}

PackVertex take a gdbi vertex and convert it to a mongo doc

func UnpackEdge

func UnpackEdge(i map[string]interface{}) *gripql.Edge

UnpackEdge takes a mongo doc and convertes it into an gripql.Edge

func UnpackVertex

func UnpackVertex(i map[string]interface{}) *gripql.Vertex

UnpackVertex takes a mongo doc and converts it into an gripql.Vertex

Types

type Config

type Config struct {
	URL         string
	DBName      string
	Username    string
	Password    string
	Synchronous bool
	BatchSize   int
}

Config describes the configuration for the elasticsearch driver.

func (*Config) SetDefaults

func (c *Config) SetDefaults()

type Graph

type Graph struct {
	// contains filtered or unexported fields
}

Graph is a graph database backended by elastic search

func (*Graph) AddEdge

func (es *Graph) AddEdge(edges []*gdbi.Edge) error

AddEdge adds an edge to the graph, if the id is not "" and in already exists in the graph, it is replaced

func (*Graph) AddVertex

func (es *Graph) AddVertex(vertices []*gdbi.Vertex) error

AddVertex adds an edge to the graph, if the id is not "" and in already exists in the graph, it is replaced

func (*Graph) AddVertexIndex

func (es *Graph) AddVertexIndex(label string, field string) error

AddVertexIndex adds a new field to be indexed

func (*Graph) BulkAdd

func (es *Graph) BulkAdd(stream <-chan *gdbi.GraphElement) error

func (*Graph) Compiler

func (es *Graph) Compiler() gdbi.Compiler

Compiler returns a query compiler that will use elastic search as a backend

func (*Graph) DelEdge

func (es *Graph) DelEdge(eid string) error

DelEdge deletes edge `eid`

func (*Graph) DelVertex

func (es *Graph) DelVertex(vid string) error

DelVertex deletes vertex `vid` and all adjacent edges

func (*Graph) DeleteVertexIndex

func (es *Graph) DeleteVertexIndex(label string, field string) error

DeleteVertexIndex removes a vertex field index

func (*Graph) GetEdge

func (es *Graph) GetEdge(id string, load bool) *gdbi.Edge

GetEdge gets a specific edge

func (*Graph) GetEdgeList

func (es *Graph) GetEdgeList(ctx context.Context, load bool) <-chan *gdbi.Edge

GetEdgeList produces a channel of all edges in the graph

func (*Graph) GetInChannel

func (es *Graph) GetInChannel(ctx context.Context, req chan gdbi.ElementLookup, load bool, emitNull bool, edgeLabels []string) chan gdbi.ElementLookup

GetInChannel gets all vertices connected to lookup elements by incoming edges

func (*Graph) GetInEdgeChannel

func (es *Graph) GetInEdgeChannel(ctx context.Context, req chan gdbi.ElementLookup, load bool, emitNull bool, edgeLabels []string) chan gdbi.ElementLookup

GetInEdgeChannel gets incoming edges connected to lookup element

func (*Graph) GetOutChannel

func (es *Graph) GetOutChannel(ctx context.Context, req chan gdbi.ElementLookup, load bool, emitNull bool, edgeLabels []string) chan gdbi.ElementLookup

GetOutChannel gets channel of all vertices connected to element via outgoing edge

func (*Graph) GetOutEdgeChannel

func (es *Graph) GetOutEdgeChannel(ctx context.Context, req chan gdbi.ElementLookup, load bool, emitNull bool, edgeLabels []string) chan gdbi.ElementLookup

GetOutEdgeChannel gets all outgoing edges connected to lookup element

func (*Graph) GetTimestamp

func (es *Graph) GetTimestamp() string

GetTimestamp returns the change timestamp of the current graph

func (*Graph) GetVertex

func (es *Graph) GetVertex(id string, load bool) *gdbi.Vertex

GetVertex gets vertex `id`

func (*Graph) GetVertexChannel

func (es *Graph) GetVertexChannel(ctx context.Context, req chan gdbi.ElementLookup, load bool) chan gdbi.ElementLookup

GetVertexChannel get a channel that returns all vertices in a graph

func (*Graph) GetVertexIndexList

func (es *Graph) GetVertexIndexList() <-chan *gripql.IndexID

GetVertexIndexList gets list if vertex indices

func (*Graph) GetVertexList

func (es *Graph) GetVertexList(ctx context.Context, load bool) <-chan *gdbi.Vertex

GetVertexList produces a channel of all vertices in the graph

func (*Graph) ListEdgeLabels

func (es *Graph) ListEdgeLabels() ([]string, error)

ListEdgeLabels returns a list of edge types in the graph

func (*Graph) ListVertexLabels

func (es *Graph) ListVertexLabels() ([]string, error)

ListVertexLabels returns a list of vertex types in the graph

func (*Graph) VertexLabelScan

func (es *Graph) VertexLabelScan(ctx context.Context, label string) chan string

VertexLabelScan produces a channel of all vertex ids where the vertex label matches `label`

type GraphDB

type GraphDB struct {
	// contains filtered or unexported fields
}

GraphDB implements the GraphDB interface with elasticsearch as a backend

func (*GraphDB) AddGraph

func (es *GraphDB) AddGraph(graph string) error

AddGraph adds a new graph to the graphdb

func (*GraphDB) BuildSchema

func (es *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) Close

func (es *GraphDB) Close() error

Close closes connection to elastic search

func (*GraphDB) DeleteGraph

func (es *GraphDB) DeleteGraph(graph string) error

DeleteGraph deletes a graph from the graphdb

func (*GraphDB) Graph

func (es *GraphDB) Graph(graph string) (gdbi.GraphInterface, error)

Graph returns interface to a specific graph in the graphdb

func (*GraphDB) ListGraphs

func (es *GraphDB) ListGraphs() []string

ListGraphs returns list of graphs on elastic search instance

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL