Documentation
¶
Overview ¶
Package domain contains pure business entities for layli.
This package defines the core domain model with NO external dependencies (only Go stdlib). These types represent the "ubiquitous language" from our Gherkin feature files.
Key principles:
- No dependencies on external packages (except Go stdlib)
- Value objects are immutable where possible
- Business logic lives here, not in adapters
- Types map directly to concepts in feature files
Domain entities:
- Diagram: Complete diagram specification
- Node: A box/component in the diagram
- Edge: A connection between nodes
- Position: X/Y coordinates on the grid
- Path: A series of positions forming an edge route
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bounds ¶
Bounds represents a rectangular boundary.
type Diagram ¶
type Diagram struct {
Nodes []Node
Edges []Edge
Config DiagramConfig
}
Diagram represents the complete diagram specification. Maps to: "Given a diagram with..." in feature files.
type DiagramConfig ¶
type DiagramConfig struct {
LayoutType LayoutType
LayoutAttempts int
NodeWidth int
NodeHeight int
Border int
Margin int
Spacing int
PathAttempts int
PathStrategy string
Pathfinding PathfindingConfig
Styles map[string]string
}
DiagramConfig holds diagram-level settings.
type Edge ¶
type Edge struct {
ID string
From string // Node ID
To string // Node ID
Path *Path // Calculated path (may be nil before pathfinding)
Class string
Style string
}
Edge represents a connection between two nodes. Maps to: "And an edge from 'A' to 'B'" in feature files.
type LayoutType ¶
type LayoutType string
LayoutType enumerates available layout algorithms. When adding a new layout algorithm, add the constant here, then: 1. Implement LayoutXxx function in layout/arrangements.go 2. Register in selectArrangement() in layout/arrangements.go 3. Register in selectArranger() in internal/adapters/layout/engine.go 4. Add tests to layout/arrangements_test.go See CONTRIBUTING_LAYOUTS.md for detailed instructions.
const ( LayoutFlowSquare LayoutType = "flow-square" LayoutTopoSort LayoutType = "topo-sort" LayoutTarjan LayoutType = "tarjan" LayoutAbsolute LayoutType = "absolute" LayoutRandomShortest LayoutType = "random-shortest-square" )
type Node ¶
type Node struct {
ID string
Contents string
Position Position
Width int
Height int
Class string
Style string
}
Node represents a box/component in the diagram. Maps to: "And a node 'A'" in feature files.
type Path ¶
type Path struct {
Points []Position
}
Path represents a series of positions forming an edge route.
type PathfindingAlgorithm ¶ added in v0.0.16
type PathfindingAlgorithm string
PathfindingAlgorithm enumerates available pathfinding algorithms. When adding a new pathfinding algorithm, add the constant here.
const ( PathfindingDijkstra PathfindingAlgorithm = "dijkstra" PathfindingAStar PathfindingAlgorithm = "astar" PathfindingBidirectional PathfindingAlgorithm = "bidirectional" )
type PathfindingConfig ¶ added in v0.0.16
type PathfindingConfig struct {
Algorithm PathfindingAlgorithm
Heuristic PathfindingHeuristic
}
PathfindingConfig holds pathfinding algorithm settings.
type PathfindingHeuristic ¶ added in v0.0.16
type PathfindingHeuristic string
PathfindingHeuristic enumerates available heuristic functions for A*.
const ( HeuristicEuclidean PathfindingHeuristic = "euclidean" HeuristicManhattan PathfindingHeuristic = "manhattan" )