psql

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: 16 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 GraphDB graph database interface

Types

type Config

type Config struct {
	Host     string
	Port     uint
	User     string
	Password string
	DBName   string
	SSLMode  string
}

Config describes the configuration for the sql driver. See https://godoc.org/github.com/lib/pq#hdr-Connection_String_Parameters for details.

type Graph

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

Graph is the interface to a single graph

func (*Graph) AddEdge

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

AddEdge adds an edge to the database

func (*Graph) AddVertex

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

AddVertex adds a vertex to the database

func (*Graph) AddVertexIndex

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

AddVertexIndex add index to vertices

func (*Graph) BulkAdd

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

func (*Graph) Compiler

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

Compiler returns a query compiler that uses the graph

func (*Graph) DelEdge

func (g *Graph) DelEdge(key string) error

DelEdge is not implemented in the SQL driver

func (*Graph) DelVertex

func (g *Graph) DelVertex(key string) error

DelVertex is not implemented in the SQL driver

func (*Graph) DeleteVertexIndex

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

DeleteVertexIndex delete index from vertices

func (*Graph) GetEdge

func (g *Graph) GetEdge(gid string, load bool) *gdbi.Edge

GetEdge loads an edge given an id. It returns a nil if not found.

func (*Graph) GetEdgeList

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

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 is passed a channel of vertex ids and finds the connected vertices via 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 is passed a channel of vertex ids and finds the 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 is passed a channel of vertex ids and finds the connected vertices via 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 is passed a channel of vertex ids and finds the outgoing edges

func (*Graph) GetTimestamp

func (g *Graph) GetTimestamp() string

GetTimestamp gets the timestamp of last update

func (*Graph) GetVertex

func (g *Graph) GetVertex(gid string, load bool) *gdbi.Vertex

GetVertex loads a vertex given an id. It returns a nil if not found.

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

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

GetVertexIndexList lists indices

func (*Graph) GetVertexList

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

GetVertexList produces a channel of all vertices in the graph

func (*Graph) ListEdgeLabels

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

ListEdgeLabels returns a list of edge types in the graph

func (*Graph) ListVertexLabels

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

ListVertexLabels returns a list of vertex types in the graph

func (*Graph) VertexLabelScan

func (g *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 manages graphs in the database

func (*GraphDB) AddGraph

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

AddGraph creates a new graph named `graph`

func (*GraphDB) BuildSchema

func (db *GraphDB) BuildSchema(ctx context.Context, graphID string, sampleN uint32, random bool) (*gripql.Graph, error)

BuildSchema returns the schema of a specific graph in the database

func (*GraphDB) Close

func (db *GraphDB) Close() error

Close the connection

func (*GraphDB) DeleteGraph

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

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

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

ListGraphs lists the graphs managed by this driver

Jump to

Keyboard shortcuts

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