refactor

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2026 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Renamer

type Renamer struct{}

Renamer provides node renaming functionality with reference updates.

func NewRenamer

func NewRenamer() *Renamer

NewRenamer creates a new Renamer.

func (*Renamer) Rename

func (r *Renamer) Rename(nodes []domain.Node, oldID, newID string) ([]domain.Node, error)

Rename changes a node's ID and updates all references pointing to it. Returns a new slice with the renamed node and updated references. The original nodes slice is not modified.

Parameters:

  • nodes: slice of all nodes in the graph
  • oldID: the current ID of the node to rename
  • newID: the new ID for the node

Returns:

  • updated slice of nodes with the rename applied
  • error if oldID doesn't exist, newID already exists, or IDs are invalid

func (*Renamer) UpdateReferences

func (r *Renamer) UpdateReferences(nodes []domain.Node, oldID, newID string) ([]domain.Node, error)

UpdateReferences updates all references from oldID to newID across all nodes. Unlike Rename, this does not require oldID to exist as a node - useful for detecting manual renames where the old node file was already deleted/renamed. Returns a new slice with updated references. Nodes whose references were updated will have their version incremented.

Jump to

Keyboard shortcuts

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