d2

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2025 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewD2OracleRepository added in v0.2.0

func NewD2OracleRepository() repository.OracleRepository

NewD2OracleRepository creates a new D2 repository with Oracle support

func NewD2Repository

func NewD2Repository() repository.DiagramRepository

NewD2Repository creates a new D2 repository instance.

Types

type D2OracleRepository added in v0.2.0

type D2OracleRepository struct {
	*D2Repository
	// contains filtered or unexported fields
}

D2OracleRepository extends D2Repository with Oracle capabilities

func (*D2OracleRepository) CreateElement added in v0.2.0

func (r *D2OracleRepository) CreateElement(ctx context.Context, diagramID string, boardPath []string, key string) (*entity.OracleResult, error)

CreateElement creates a new shape or connection

func (*D2OracleRepository) DeleteElement added in v0.2.0

func (r *D2OracleRepository) DeleteElement(ctx context.Context, diagramID string, boardPath []string, key string) (*entity.OracleResult, error)

DeleteElement deletes a shape or connection

func (*D2OracleRepository) GetChildren added in v0.2.0

func (r *D2OracleRepository) GetChildren(ctx context.Context, diagramID string, boardPath []string, parentID string) ([]string, error)

GetChildren retrieves child element IDs

func (*D2OracleRepository) GetEdge added in v0.2.0

func (r *D2OracleRepository) GetEdge(ctx context.Context, diagramID string, boardPath []string, edgeID string) (*entity.GraphEdge, error)

GetEdge retrieves edge information

func (*D2OracleRepository) GetObject added in v0.2.0

func (r *D2OracleRepository) GetObject(ctx context.Context, diagramID string, boardPath []string, objectID string) (*entity.GraphObject, error)

GetObject retrieves object information

func (*D2OracleRepository) LoadDiagram added in v0.2.0

func (r *D2OracleRepository) LoadDiagram(ctx context.Context, diagramID string, content string) error

LoadDiagram loads a diagram from D2 text

func (*D2OracleRepository) MoveElement added in v0.2.0

func (r *D2OracleRepository) MoveElement(ctx context.Context, diagramID string, boardPath []string, key, newKey string, includeDescendants bool) (*entity.OracleResult, error)

MoveElement moves a shape to a new container

func (*D2OracleRepository) RenameElement added in v0.2.0

func (r *D2OracleRepository) RenameElement(ctx context.Context, diagramID string, boardPath []string, key, newName string) (*entity.OracleResult, error)

RenameElement renames a shape or connection

func (*D2OracleRepository) SerializeDiagram added in v0.2.0

func (r *D2OracleRepository) SerializeDiagram(ctx context.Context, diagramID string) (string, error)

SerializeDiagram converts the current graph state back to D2 text

func (*D2OracleRepository) SetAttribute added in v0.2.0

func (r *D2OracleRepository) SetAttribute(ctx context.Context, diagramID string, boardPath []string, key string, tag, value *string) (*entity.OracleResult, error)

SetAttribute sets attributes on a shape or connection

type D2Repository

type D2Repository struct {
	// contains filtered or unexported fields
}

D2Repository implements the DiagramRepository interface using D2.

func (*D2Repository) Create

func (r *D2Repository) Create(ctx context.Context, diagram *entity.Diagram) error

Create creates a new diagram programmatically.

func (*D2Repository) Export

func (r *D2Repository) Export(ctx context.Context, diagramID string, format entity.ExportFormat) (io.Reader, error)

Export exports the diagram to the specified format.

func (*D2Repository) Render

func (r *D2Repository) Render(ctx context.Context, content string, format entity.ExportFormat, theme *entity.Theme) (io.Reader, error)

Render renders D2 text into a diagram with specified format.

type OracleSession added in v0.2.0

type OracleSession struct {
	DiagramID    string
	Graph        *d2graph.Graph
	AST          *d2ast.Map
	LastModified time.Time
	Operations   []entity.OracleOperation // History tracking
}

OracleSession represents an active Oracle editing session

Jump to

Keyboard shortcuts

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