cypher

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 9, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package cypher generates Neo4j Cypher statements from graph data.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EdgeToCreate

func EdgeToCreate(e *graph.Edge) string

EdgeToCreate generates a CREATE statement for a single edge.

func EscapeKey

func EscapeKey(s string) string

EscapeKey ensures a key is valid for Cypher property names.

func EscapeString

func EscapeString(s string) string

EscapeString escapes a string for use in Cypher queries.

func NodeToCreate

func NodeToCreate(n *graph.Node) string

NodeToCreate generates a CREATE statement for a single node.

func ToNeoLabel

func ToNeoLabel(nodeType string) string

ToNeoLabel converts a graphize node type to a Neo4j label. Example: "function" -> "Function", "method_call" -> "MethodCall"

func ToNeoRelType

func ToNeoRelType(edgeType string) string

ToNeoRelType converts a graphize edge type to a Neo4j relationship type. Neo4j relationship types are typically UPPERCASE.

Types

type Generator

type Generator struct {
	// IncludeHeader adds usage comments at the top of the output.
	IncludeHeader bool

	// IncludeConstraint adds a UNIQUE constraint statement.
	IncludeConstraint bool
}

Generator creates Neo4j Cypher CREATE statements from graph nodes and edges.

func NewGenerator

func NewGenerator() *Generator

NewGenerator creates a Generator with default settings.

func (*Generator) Generate

func (g *Generator) Generate(nodes []*graph.Node, edges []*graph.Edge) string

Generate creates Cypher statements for all nodes and edges.

Jump to

Keyboard shortcuts

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