graph

package
v1.1.2 Latest Latest
Warning

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

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

Documentation

Overview

Package graph defines the core data model for the gograph tool.

Index

Constants

View Source
const Version = "1"

Version is the schema version written into graph.json.

Variables

This section is empty.

Functions

This section is empty.

Types

type CallEdge

type CallEdge struct {
	CallerSymbolID string `json:"caller_symbol_id"`
	CallerName     string `json:"caller_name"`
	CalleeRaw      string `json:"callee_raw"`
	File           string `json:"file"`
	Line           int    `json:"line"`
}

CallEdge records a call expression found inside a function/method body.

type Dependency added in v1.1.0

type Dependency struct {
	Module  string `json:"module"`
	Version string `json:"version"`
}

Dependency represents a go.mod dependency.

type EnvRead

type EnvRead struct {
	Key      string `json:"key"`
	Accessor string `json:"accessor"`
	File     string `json:"file"`
	Line     int    `json:"line"`
	Function string `json:"function,omitempty"`
}

EnvRead records a detected environment variable read.

type ErrorEdge added in v1.1.2

type ErrorEdge struct {
	Message  string `json:"message"`
	Function string `json:"function"`
	File     string `json:"file"`
	Line     int    `json:"line"`
}

ErrorEdge represents an extracted error message or panic.

type FileNode

type FileNode struct {
	ID          string `json:"id"`
	Path        string `json:"path"`
	PackageName string `json:"package_name"`
	Lines       int    `json:"lines"`
	Generated   bool   `json:"generated"`
}

FileNode represents a single .go source file.

type Graph

type Graph struct {
	Version      string        `json:"version"`
	GeneratedAt  time.Time     `json:"generated_at"`
	Root         string        `json:"root"`
	Packages     []PackageNode `json:"packages"`
	Files        []FileNode    `json:"files"`
	Symbols      []SymbolNode  `json:"symbols"`
	Imports      []ImportEdge  `json:"imports"`
	Calls        []CallEdge    `json:"calls"`
	EnvReads     []EnvRead     `json:"env_reads"`
	Dependencies []Dependency  `json:"dependencies"`
	Routes       []HTTPRoute   `json:"routes,omitempty"`
	ImportEdges  []ImportEdge  `json:"import_edges,omitempty"`
	SQLs         []SQLEdge     `json:"sqls,omitempty"`
	Errors       []ErrorEdge   `json:"errors,omitempty"`
}

Graph is the top-level data structure written to .gograph/graph.json.

type HTTPRoute added in v1.1.2

type HTTPRoute struct {
	Method  string `json:"method"`
	Path    string `json:"path"`
	Handler string `json:"handler"`
	File    string `json:"file"`
	Line    int    `json:"line"`
}

HTTPRoute represents an HTTP REST endpoint found in the AST.

type ImportEdge

type ImportEdge struct {
	FromFile    string `json:"from_file"`
	FromPackage string `json:"from_package"`
	ImportPath  string `json:"import_path"`
	Alias       string `json:"alias,omitempty"`
}

ImportEdge records an import statement in a file.

type PackageNode

type PackageNode struct {
	ID                   string   `json:"id"`
	Name                 string   `json:"name"`
	ImportPathBestEffort string   `json:"import_path_best_effort"`
	Dir                  string   `json:"dir"`
	Files                []string `json:"files"`
}

PackageNode represents a Go package found in the repository.

type SQLEdge added in v1.1.2

type SQLEdge struct {
	Query    string `json:"query"`
	Function string `json:"function"`
	File     string `json:"file"`
	Line     int    `json:"line"`
}

SQLEdge represents an extracted SQL query.

type StructField added in v1.1.2

type StructField struct {
	Name string `json:"name"`
	Type string `json:"type"`
	Tag  string `json:"tag,omitempty"`
}

StructField represents a field inside a struct.

type SymbolKind

type SymbolKind string

SymbolKind categorises a symbol.

const (
	KindFunction  SymbolKind = "function"
	KindMethod    SymbolKind = "method"
	KindStruct    SymbolKind = "struct"
	KindInterface SymbolKind = "interface"
)

type SymbolNode

type SymbolNode struct {
	ID               string            `json:"id"`
	Kind             SymbolKind        `json:"kind"`
	Name             string            `json:"name"`
	Receiver         string            `json:"receiver,omitempty"`
	PackageName      string            `json:"package_name"`
	File             string            `json:"file"`
	Line             int               `json:"line"`
	EndLine          int               `json:"end_line"`
	Doc              string            `json:"doc,omitempty"`
	Signature        string            `json:"signature,omitempty"`
	MethodSignature  string            `json:"method_signature,omitempty"`
	InterfaceMethods map[string]string `json:"interface_methods,omitempty"`
	StructFields     []StructField     `json:"struct_fields,omitempty"`
	EmbeddedStructs  []string          `json:"embedded_structs,omitempty"`
}

SymbolNode represents a named symbol (function, method, struct, interface).

Jump to

Keyboard shortcuts

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