gograph

module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2026 License: MIT

README

GoGraph

The Minimalist Embedded Graph Database in Pure Go

Go Reference Go Version Go Report Card codecov Docs

简体中文 | English


📖 Project Overview

GoGraph is a lightweight, zero-dependency, embedded graph database written entirely in Go. Think of it as "SQLite for Graph Databases".

It allows Go developers to execute Cypher queries (the standard graph query language) and manage local graph data—nodes, relationships, and properties—without the overhead of external heavy database services like Neo4j.

⚡ Quick Start

The fastest way to explore GoGraph is via the CLI.

macOS / Linux (Homebrew):

brew install dotnetage/tap/gograph

Run TUI (Interactive Shell):

# Simply run without arguments to open default.db in interactive mode
gograph

2. Use as a Go Library

Add GoGraph to your project:

go get github.com/DotNetAge/gograph

Basic Example:

package main

import (
	"context"
	"fmt"
	"github.com/DotNetAge/gograph/pkg/api"
)

func main() {
	db, _ := api.Open("default.db")
	defer db.Close()

	ctx := context.Background()
	db.Exec(ctx, "CREATE (a:User {name: 'Alice'})-[:KNOWS]->(b:User {name: 'Bob'})")
	
	rows, _ := db.Query(ctx, "MATCH (u:User) RETURN u.name")
	defer rows.Close()
	
	for rows.Next() {
		var name string
		rows.Scan(&name)
		fmt.Println("User:", name)
	}
}

✨ Key Features

  • 🚀 Pure Go: No CGO, seamless cross-platform support.
  • 📦 Embedded: Zero-config, single-directory storage (Pebble DB).
  • 🔍 Cypher Support: Native MATCH, CREATE, SET, DELETE.
  • 🛡️ ACID: MVCC, thread-safety, and WAL recovery.
  • 🛠️ TUI Included: Interactive shell with auto-completion and ASCII tables.

💻 CLI Usage

The gograph binary provides a powerful TUI and command-line utilities.

Command Description
gograph Launch Interactive TUI (default to default.db)
gograph query <cypher> Run a read-only query
gograph exec <cypher> Run a data modification command

Example:

gograph query "MATCH (n) RETURN n"

🧩 System Compatibility

  • OS: macOS, Linux, Windows.
  • Arch: amd64, arm64.

📚 Documentation

Check out the full Documentation or the Docs Folder.

Directories

Path Synopsis
cmd
gograph command
pkg
api
Package api provides the public database API for gograph, a graph database engine.
Package api provides the public database API for gograph, a graph database engine.
cypher
Package cypher provides Cypher query parsing and execution capabilities for gograph.
Package cypher provides Cypher query parsing and execution capabilities for gograph.
graph
Package graph provides core data structures and interfaces for the gograph database.
Package graph provides core data structures and interfaces for the gograph database.
storage
Package storage provides the底层 storage layer for gograph using Pebble as the underlying key-value store.
Package storage provides the底层 storage layer for gograph using Pebble as the underlying key-value store.
tx
Package tx provides transaction management for gograph's storage layer.
Package tx provides transaction management for gograph's storage layer.

Jump to

Keyboard shortcuts

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