diagrams

package
v0.1.14 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var IsGraphvizAvailable = func() bool {
	cmd := execCommand("which", "dot")
	if err := cmd.Run(); err != nil {
		return false
	}
	return true
}

IsGraphvizAvailable checks if the user has graphviz (dot) installed Using a variable to enable mocking in tests

Functions

func GenerateERDiagram

func GenerateERDiagram(def *parser.SORDefinition, outputPath string) error

GenerateERDiagram creates an ER diagram from the SOR definition If Graphviz is available, it generates an SVG file directly Otherwise, it generates just a DOT file

Types

type ERDiagramGenerator

type ERDiagramGenerator struct {
	Definition    *parser.SORDefinition
	Entities      map[string]Entity
	Relationships []Relationship
}

ERDiagramGenerator handles the generation of ER diagrams

func NewERDiagramGenerator

func NewERDiagramGenerator(definition *parser.SORDefinition) *ERDiagramGenerator

NewERDiagramGenerator creates a new ERDiagramGenerator instance

func (*ERDiagramGenerator) Generate

func (g *ERDiagramGenerator) Generate(outputPath string) error

Generate creates the ER diagram as a DOT file

type Entity

type Entity struct {
	ID         string
	Name       string
	ExternalID string
}

Entity represents a node in the ER diagram

type Relationship

type Relationship struct {
	ID            string
	DisplayName   string
	FromEntity    string
	ToEntity      string
	FromAttribute string
	ToAttribute   string
	FromIsUnique  bool
	ToIsUnique    bool
	PathBased     bool
}

Relationship represents an edge in the ER diagram

Jump to

Keyboard shortcuts

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