Documentation
¶
Overview ¶
Package graph provides an intermediate graph representation for rendering system-spec to various diagram formats.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Edge ¶
type Edge struct {
// ID is the unique edge identifier
ID string `json:"id"`
// Source node ID
Source string `json:"source"`
// Target node ID
Target string `json:"target"`
// Label for display
Label string `json:"label,omitempty"`
// Kind categorizes the edge
Kind EdgeKind `json:"kind"`
// Protocol (http, grpc, tcp, sql, amqp, redis, etc.)
Protocol string `json:"protocol,omitempty"`
// Port number
Port int `json:"port,omitempty"`
// Metadata contains additional key-value data
Metadata map[string]string `json:"metadata,omitempty"`
}
Edge represents a directed edge between nodes.
type EdgeKind ¶
type EdgeKind string
EdgeKind categorizes edges for rendering and styling.
const ( EdgeKindConnection EdgeKind = "connection" // service to service EdgeKindDatabase EdgeKind = "database" // service to database EdgeKindQueue EdgeKind = "queue" // service to queue EdgeKindStorage EdgeKind = "storage" // service to storage EdgeKindDeploys EdgeKind = "deploys" // helm/terraform to service )
type Graph ¶
type Graph struct {
// Nodes in the graph
Nodes []Node `json:"nodes"`
// Edges connecting nodes
Edges []Edge `json:"edges"`
}
Graph is the intermediate representation for rendering. It decouples the spec structure from renderer output formats.
func FromSystem ¶
FromSystem converts a System spec to a Graph for rendering.
type Node ¶
type Node struct {
// ID is the unique node identifier
ID string `json:"id"`
// Label is the display name
Label string `json:"label"`
// Kind categorizes the node for styling
Kind NodeKind `json:"kind"`
// Group for clustering (e.g., VPC name, namespace)
Group string `json:"group,omitempty"`
// Metadata contains additional key-value data for renderers
Metadata map[string]string `json:"metadata,omitempty"`
}
Node represents a vertex in the graph.
type NodeKind ¶
type NodeKind string
NodeKind categorizes nodes for rendering and styling.
const ( NodeKindService NodeKind = "service" NodeKindDatabase NodeKind = "database" NodeKindQueue NodeKind = "queue" NodeKindTopic NodeKind = "topic" NodeKindStorage NodeKind = "storage" NodeKindCDN NodeKind = "cdn" NodeKindWorker NodeKind = "worker" NodeKindAIModel NodeKind = "ai_model" NodeKindVPC NodeKind = "vpc" NodeKindSubnet NodeKind = "subnet" NodeKindExternal NodeKind = "external" NodeKindHelm NodeKind = "helm" NodeKindTerraform NodeKind = "terraform" )
Click to show internal directories.
Click to hide internal directories.