simplegraph

package module
v0.0.0-...-28607ac Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DeleteEdge = `DELETE FROM edges WHERE source = ? OR target = ?
`

	DeleteNode = `DELETE FROM nodes WHERE id = ?
`

	InsertEdge = `INSERT INTO edges VALUES(?, ?, json(?))
`

	InsertNode = `INSERT INTO nodes VALUES(json(?))
`

	Schema = `` /* 495-byte string literal not displayed */

	SearchEdgesInbound = `SELECT * FROM edges WHERE source = ?
`

	SearchEdgesOutbound = `SELECT * FROM edges WHERE target = ?
`

	SearchEdges = `SELECT * FROM edges WHERE source = ? 
UNION
SELECT * FROM edges WHERE target = ?
`

	SearchNodeById = `SELECT body FROM nodes WHERE id = ?
`

	SearchNode = `SELECT body FROM nodes WHERE 
`

	TraverseInbound = `` /* 135-byte string literal not displayed */

	TraverseOutbound = `` /* 135-byte string literal not displayed */

	Traverse = `` /* 199-byte string literal not displayed */

	TraverseWithBodiesInbound = `` /* 245-byte string literal not displayed */

	TraverseWithBodiesOutbound = `` /* 245-byte string literal not displayed */

	TraverseWithBodies = `` /* 326-byte string literal not displayed */

	UpdateNode = `UPDATE nodes SET body = json(?) WHERE id = ?
`
)
View Source
const (
	SQLITE                  = "sqlite3"
	WITH_FOREIGN_KEY_PRAGMA = "%s?_foreign_keys=true"
	ID_CONSTRAINT           = "NOT NULL constraint failed: nodes.id"
	UNIQUE_ID_CONSTRAINT    = "UNIQUE constraint failed: nodes.id"
	NO_ROWS_FOUND           = "sql: no rows in result set"
)

Variables

This section is empty.

Functions

func AddNode

func AddNode(identifier string, node []byte, database ...string) (int64, error)

func AddNodes

func AddNodes(identifiers []string, nodes [][]byte, database ...string) (int64, error)

func BulkConnectNodes

func BulkConnectNodes(sources []string, targets []string, database ...string) (int64, error)

func BulkConnectNodesWithProperties

func BulkConnectNodesWithProperties(sources []string, targets []string, properties []string, database ...string) (int64, error)

func ConnectNodes

func ConnectNodes(sourceId string, targetId string, database ...string) (int64, error)

func ConnectNodesWithProperties

func ConnectNodesWithProperties(sourceId string, targetId string, properties []byte, database ...string) (int64, error)

func FindNode

func FindNode(identifier string, database ...string) (string, error)

func FindNodes

func FindNodes(properties map[string]string, startsWith bool, contains bool, database ...string) ([]string, error)

func Initialize

func Initialize(database ...string)

func RemoveNodes

func RemoveNodes(identifiers []string, database ...string) bool

func TraverseFrom

func TraverseFrom(source string, traversal string, database ...string) ([]string, error)

func TraverseFromTo

func TraverseFromTo(source string, target string, traversal string, database ...string) ([]string, error)

func UpdateNodeBody

func UpdateNodeBody(identifier string, body string, database ...string) error

func UpsertNode

func UpsertNode(identifier string, body string, database ...string) error

func Visualize

func Visualize(path []string, database ...string) string

func VisualizeBodies

func VisualizeBodies(path []GraphData, database ...string) string

Types

type EdgeData

type EdgeData struct {
	Source string
	Target string
	Label  string
}

func Connections

func Connections(identifier string, database ...string) ([]EdgeData, error)

func ConnectionsIn

func ConnectionsIn(identifier string, database ...string) ([]EdgeData, error)

func ConnectionsOut

func ConnectionsOut(identifier string, database ...string) ([]EdgeData, error)

type EdgeSet

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

func NewEdgeSet

func NewEdgeSet() *EdgeSet

func (*EdgeSet) Add

func (set *EdgeSet) Add(edge EdgeData) bool

func (*EdgeSet) Contains

func (set *EdgeSet) Contains(edge EdgeData) bool

type GraphData

type GraphData struct {
	Node NodeData
	Edge EdgeData
}

func TraverseWithBodiesFrom

func TraverseWithBodiesFrom(source string, traversal string, database ...string) ([]GraphData, error)

func TraverseWithBodiesFromTo

func TraverseWithBodiesFromTo(source string, target string, traversal string, database ...string) ([]GraphData, error)

type NodeData

type NodeData struct {
	Identifier interface{} `json:"id"`
	Body       interface{}
}

Jump to

Keyboard shortcuts

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