repository

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DiagramRepository

type DiagramRepository interface {
	// Render renders D2 text into a diagram with specified format.
	Render(ctx context.Context, content string, format entity.ExportFormat, theme *entity.Theme) (io.Reader, error)

	// Create creates a new diagram programmatically.
	Create(ctx context.Context, diagram *entity.Diagram) error

	// Export exports the diagram to the specified format.
	Export(ctx context.Context, diagramID string, format entity.ExportFormat) (io.Reader, error)
}

DiagramRepository defines the interface for diagram operations.

type OracleRepository added in v0.2.0

type OracleRepository interface {
	DiagramRepository // Embed existing interface

	// CreateElement creates a new shape or connection
	CreateElement(ctx context.Context, diagramID string, boardPath []string, key string) (*entity.OracleResult, error)

	// SetAttribute sets attributes on a shape or connection
	SetAttribute(ctx context.Context, diagramID string, boardPath []string, key string, tag, value *string) (*entity.OracleResult, error)

	// DeleteElement deletes a shape or connection
	DeleteElement(ctx context.Context, diagramID string, boardPath []string, key string) (*entity.OracleResult, error)

	// MoveElement moves a shape to a new container
	MoveElement(ctx context.Context, diagramID string, boardPath []string, key, newKey string, includeDescendants bool) (*entity.OracleResult, error)

	// RenameElement renames a shape or connection
	RenameElement(ctx context.Context, diagramID string, boardPath []string, key, newName string) (*entity.OracleResult, error)

	// GetObject retrieves object information
	GetObject(ctx context.Context, diagramID string, boardPath []string, objectID string) (*entity.GraphObject, error)

	// GetEdge retrieves edge information
	GetEdge(ctx context.Context, diagramID string, boardPath []string, edgeID string) (*entity.GraphEdge, error)

	// GetChildren retrieves child element IDs
	GetChildren(ctx context.Context, diagramID string, boardPath []string, parentID string) ([]string, error)

	// LoadDiagram loads a diagram from D2 text
	LoadDiagram(ctx context.Context, diagramID string, content string) error

	// SerializeDiagram converts the current graph state back to D2 text
	SerializeDiagram(ctx context.Context, diagramID string) (string, error)
}

OracleRepository defines Oracle API operations for incremental diagram manipulation

Jump to

Keyboard shortcuts

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