contracts

package
v0.0.2 Latest Latest
Warning

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

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

Documentation

Overview

Package contracts defines the core data structures for the structural graph.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Edge

type Edge struct {
	FromID   string                 `json:"from_id"`
	ToID     string                 `json:"to_id"`
	Type     EdgeType               `json:"type"`
	Sequence int                    `json:"sequence"`
	Metadata map[string]interface{} `json:"metadata"`
}

Edge represents a directed relationship between two nodes in the graph.

type EdgeType

type EdgeType string

EdgeType represents the nature of a relationship between two nodes.

const (
	// EdgeCalls indicates that one symbol calls another.
	EdgeCalls EdgeType = "CALLS"
	// EdgeImplements indicates that a type implements an interface.
	EdgeImplements EdgeType = "IMPLEMENTS"
	// EdgeUses indicates that one symbol uses or references another.
	EdgeUses EdgeType = "USES"
	// EdgeImports indicates that one file or package imports another.
	EdgeImports EdgeType = "IMPORTS"
	// EdgeBelongsTo indicates a containment relationship (e.g., method belongs to class).
	EdgeBelongsTo EdgeType = "BELONGS_TO"
	// EdgeDependsOn indicates a general dependency.
	EdgeDependsOn EdgeType = "DEPENDS_ON"
	// EdgeFlowsThrough indicates data flow between symbols.
	EdgeFlowsThrough EdgeType = "FLOWS_THROUGH"
)

type Node

type Node struct {
	ID       string                 `json:"id"`
	Type     NodeType               `json:"type"`
	Name     string                 `json:"name"`
	File     string                 `json:"file"`
	Line     int                    `json:"line"`
	Metadata map[string]interface{} `json:"metadata"`
}

Node represents a structural element (symbol) in the codebase.

type NodeType

type NodeType string

NodeType represents the kind of structural element a node represents.

const (
	// NodeFunction represents a standalone function.
	NodeFunction NodeType = "function"
	// NodeMethod represents a method belonging to a type.
	NodeMethod NodeType = "method"
	// NodeStruct represents a structure or class definition.
	NodeStruct NodeType = "struct"
	// NodeInterface represents an interface or protocol definition.
	NodeInterface NodeType = "interface"
	// NodePackage represents a software package or namespace.
	NodePackage NodeType = "package"
	// NodeModule represents a software module.
	NodeModule NodeType = "module"
	// NodeFlow represents a data or control flow path.
	NodeFlow NodeType = "flow"
)

Jump to

Keyboard shortcuts

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