Documentation
¶
Overview ¶
Package expr contains the data structure and associated logic that are built by the DSL.
The expression data structures implement interfaces defined by the Goa eval package. The corresponding methods (EvalName, Prepare, Validate, Finalize etc.) are invoked by the eval package when evaluating the DSL.
Index ¶
- Variables
- func Identify(element interface{})
- type Animation
- type AutoLayout
- type BorderKind
- type Branding
- type Component
- type ComponentView
- type Components
- type Configuration
- type Container
- type ContainerInstance
- type ContainerView
- type Containers
- type ContextView
- type Decision
- type DecisionStatusKind
- type DeploymentEnvironment
- type DeploymentNode
- func (d *DeploymentNode) AddChild(n *DeploymentNode) *DeploymentNode
- func (d *DeploymentNode) AddContainerInstance(ci *ContainerInstance) *ContainerInstance
- func (d *DeploymentNode) AddInfrastructureNode(n *InfrastructureNode) *InfrastructureNode
- func (d *DeploymentNode) Child(name string) *DeploymentNode
- func (d *DeploymentNode) ContainerInstance(container *Container, instanceID int) *ContainerInstance
- func (d *DeploymentNode) EvalName() string
- func (d *DeploymentNode) Finalize()
- func (d *DeploymentNode) InfrastructureNode(name string) *InfrastructureNode
- type DeploymentView
- type DocFormatKind
- type Documentation
- type DocumentationSection
- type DocumentationTemplateMetadata
- type DynamicView
- type Element
- func (e *Element) DSL() func()
- func (e *Element) Finalize()
- func (e *Element) GetElement() *Element
- func (e *Element) MergeTags(tags ...string)
- func (e *Element) Reachable() (res []string)
- func (e *Element) RelatedComponents() (res Components)
- func (e *Element) RelatedContainers() (res Containers)
- func (e *Element) RelatedPeople() (res People)
- func (e *Element) RelatedSoftwareSystems() (res SoftwareSystems)
- func (e *Element) Validate() error
- type ElementHolder
- type ElementStyle
- type ElementView
- type Enterprise
- type FilteredView
- type Font
- type HealthCheck
- type Image
- type InfrastructureNode
- type InteractionStyleKind
- type LandscapeView
- type LocationKind
- type Model
- func (m *Model) AddDeploymentNode(d *DeploymentNode) *DeploymentNode
- func (m *Model) AddPerson(p *Person) *Person
- func (m *Model) AddSystem(s *SoftwareSystem) *SoftwareSystem
- func (m *Model) DeploymentNode(name string) *DeploymentNode
- func (m *Model) EvalName() string
- func (m *Model) Finalize()
- func (m *Model) FindElement(n string) ElementHolder
- func (m *Model) Person(name string) *Person
- func (m *Model) SoftwareSystem(name string) *SoftwareSystem
- func (m *Model) Validate() error
- type PaperSizeKind
- type People
- type Person
- type RankDirectionKind
- type Relationship
- type RelationshipStyle
- type RelationshipView
- type RoutingKind
- type ShapeKind
- type SoftwareSystem
- type SoftwareSystems
- type Styles
- type SymbolKind
- type Terminology
- type User
- type Vertex
- type View
- type ViewAdder
- type ViewLayout
- type ViewProps
- func (v *ViewProps) AllTagged(tag string) (elts []*Element)
- func (v *ViewProps) AllUnreachable(eh ElementHolder) (elts []*Element)
- func (v *ViewProps) AllUnrelated() (elts []*Element)
- func (v *ViewProps) ElementView(id string) *ElementView
- func (v *ViewProps) EvalName() string
- func (v *ViewProps) Props() *ViewProps
- func (v *ViewProps) RelationshipView(id string) *RelationshipView
- type Views
- type Workspace
- func (w *Workspace) ApplyLayout(layout WorkspaceLayout)
- func (w *Workspace) DependsOn() []eval.Root
- func (w *Workspace) DeploymentNode(name string) *DeploymentNode
- func (w *Workspace) EvalName() string
- func (w *Workspace) Layout() WorkspaceLayout
- func (w *Workspace) MergeLayout(remote *Workspace)
- func (w *Workspace) Packages() []string
- func (w *Workspace) Person(name string) *Person
- func (w *Workspace) SoftwareSystem(name string) *SoftwareSystem
- func (w *Workspace) WalkSets(walk eval.SetWalker)
- type WorkspaceConfiguration
- type WorkspaceLayout
Constants ¶
This section is empty.
Variables ¶
var Registry = make(map[string]interface{})
Registry captures all the elements, people and relationships.
var Root = &Workspace{Model: &Model{}, Views: &Views{}}
Root is the design root expression.
Functions ¶
func Identify ¶
func Identify(element interface{})
Identify sets the ID field of the given element or relationship and registers it with the global registery. The algorithm first compute a unique moniker for the element or relatioship (based on names and parent scope ID) then hashes and base36 encodes the result.
Types ¶
type Animation ¶
type Animation struct { // Order of animation step. Order int `json:"order"` // Set of element IDs that should be included. ElementIDs []string `json:"elements,omitempty"` // Set of relationship IDs tat should be included. Relationships []string `json:"relationships,omitempty"` // Set of element that should be included. Elements []ElementHolder `json:"-"` }
Animation represents an animation step.
type AutoLayout ¶ added in v1.0.4
type AutoLayout struct { // Algorithm rank direction. RankDirection RankDirectionKind `json:"rankDirection,omitempty"` // RankSep defines the separation between ranks in pixels. RankSep *int `json:"rankSeparation,omitempty"` // NodeSep defines the separation between nodes in pixels. NodeSep *int `json:"nodeSeparation,omitempty"` // EdgeSep defines the separation between edges in pixels. EdgeSep *int `json:"edgeSeparation,omitempty"` // Render vertices if true. Vertices *bool `json:"vertices,omitempty"` }
AutoLayout describes an automatic layout.
func (*AutoLayout) EvalName ¶ added in v1.0.4
func (l *AutoLayout) EvalName() string
EvalName returns the generic expression name used in error messages.
type BorderKind ¶
type BorderKind int
BorderKind is the enum used to represent element border styles.
const ( BorderUndefined BorderKind = iota BorderSolid BorderDashed BorderDotted )
func (BorderKind) MarshalJSON ¶
func (b BorderKind) MarshalJSON() ([]byte, error)
MarshalJSON replaces the constant value with the proper string value.
func (*BorderKind) UnmarshalJSON ¶
func (b *BorderKind) UnmarshalJSON(data []byte) error
UnmarshalJSON sets the constant from its JSON representation.
type Branding ¶
type Branding struct { // URL of PNG/JPG/GIF file, or Base64 data URI representation. Logo string `json:"logo,omitempty"` // Font details. Font *Font `json:"font,omitempty"` }
Branding is a wrapper for font and logo for diagram/documentation branding purposes.
type Component ¶
type Component struct { *Element // Container is the parent container. Container *Container `json:"-"` }
Component represents a component.
type ComponentView ¶
type ComponentView struct { *ViewProps // Specifies whether container boundaries should be visible for // "external" containers (those outside the container in scope). ContainerBoundariesVisible *bool `json:"externalContainersBoundariesVisible,omitempty"` // The ID of the container this view is associated with. ContainerID string `json:"containerId"` }
ComponentView describes a component view for a specific container.
func (*ComponentView) AddAnimation ¶
func (cv *ComponentView) AddAnimation(ehs []ElementHolder) error
AddAnimation adds the given animation steps to the view.
func (*ComponentView) AddElements ¶
func (cv *ComponentView) AddElements(ehs ...ElementHolder) error
AddElements adds the given elements to the view if not already present.
func (*ComponentView) AddRelationships ¶
func (cv *ComponentView) AddRelationships(rels ...*Relationship)
AddRelationships adds the given relationships to the view if not already present. It does nothing if the relationship source and destination are not already in the view.
func (*ComponentView) Remove ¶
func (cv *ComponentView) Remove(id string)
Remove given element from view if not software system this view is for.
type Components ¶
type Components []*Component
Components is a slice of components that can be easily converted into a slice of ElementHolder.
func (Components) Elements ¶
func (cs Components) Elements() []ElementHolder
Elements returns a slice of ElementHolder that contains the elements of c.
type Configuration ¶
type Configuration struct { // Styles associated with views. Styles *Styles `json:"styles,omitempty"` // Key of view that was saved most recently. LastSavedView string `json:"lastSavedView,omitempty"` // Key of view shown by default. DefaultView string `json:"defaultView,omitempty"` // URL(s) of theme(s) used when rendering diagram. Themes []string `json:"themes,omitempty"` // Branding used in views. Branding *Branding `json:"branding,omitempty"` // Terminology used in workspace. Terminology *Terminology `json:"terminology,omitempty"` // Type of symbols used when rendering metadata. MetadataSymbols SymbolKind `json:"metadataSymbols,omitempty"` }
Configuration associated with a set of views.
func (*Configuration) EvalName ¶
func (c *Configuration) EvalName() string
EvalName returns the generic expression name used in error messages.
type Container ¶
type Container struct { *Element // Components list the components within the container. Components Components `json:"components,omitempty"` // System is the parent software system. System *SoftwareSystem `json:"-"` }
Container represents a container.
func (*Container) AddComponent ¶
AddComponent adds the given component to the container. If there is already a component with the given name then AddComponent merges both definitions. The merge algorithm:
- overrides the description, technology and URL if provided,
- merges any new tag or propery into the existing tags and properties,
- merges any new relationship into the existing relationships.
AddComponent returns the new or merged component.
func (*Container) Component ¶
Component returns the component with the given name if any, nil otherwise.
type ContainerInstance ¶
type ContainerInstance struct { // cheating a bit: a ContainerInstance does not have a name, // description, technology or URL. *Element // Parent deployment node. Parent *DeploymentNode `json:"-"` // ID of container that is instantiated. ContainerID string `json:"containerId"` // InstanceID is the number/index of this instance. InstanceID int `json:"instanceId"` // Environment is the deployment environment of this instance. Environment string `json:"environment"` // HealthChecks is the set of HTTP-based health checks for this // container instance. HealthChecks []*HealthCheck `json:"healthChecks,omitempty"` }
ContainerInstance describes an instance of a container.
func (*ContainerInstance) EvalName ¶
func (ci *ContainerInstance) EvalName() string
EvalName returns the generic expression name used in error messages.
func (*ContainerInstance) Finalize ¶
func (ci *ContainerInstance) Finalize()
Finalize removes the name value as it should not appear in the final JSON. It also adds all the implied relationships and the "Container Instance" tag if not present.
type ContainerView ¶
type ContainerView struct { *ViewProps // Specifies whether software system boundaries should be visible for // "external" containers (those outside the software system in scope). SystemBoundariesVisible *bool `json:"externalSoftwareSystemBoundariesVisible,omitempty"` // SoftwareSystemID is the ID of the software system this view with is // associated with. SoftwareSystemID string `json:"softwareSystemId"` }
ContainerView describes a container view for a specific software system.
func (*ContainerView) AddAnimation ¶
func (cv *ContainerView) AddAnimation(ehs []ElementHolder) error
AddAnimation adds the given animation steps to the view.
func (*ContainerView) AddElements ¶
func (cv *ContainerView) AddElements(ehs ...ElementHolder) error
AddElements adds the given elements to the view if not already present.
func (*ContainerView) AddRelationships ¶
func (cv *ContainerView) AddRelationships(rels ...*Relationship)
AddRelationships adds the given relationships to the view if not already present. It does nothing if the relationship source and destination are not already in the view.
func (*ContainerView) Remove ¶
func (cv *ContainerView) Remove(id string)
Remove given element from view if not software system this view is for.
type Containers ¶
type Containers []*Container
Containers is a slice of containers that can be easily converted into a slice of ElementHolder.
func (Containers) Elements ¶
func (c Containers) Elements() []ElementHolder
Elements returns a slice of ElementHolder that contains the elements of c.
type ContextView ¶
type ContextView struct { *ViewProps // EnterpriseBoundaryVisible specifies whether the enterprise boundary // (to differentiate internal elements from external elements) should be // visible on the resulting diagram. EnterpriseBoundaryVisible *bool `json:"enterpriseBoundaryVisible,omitempty"` // SoftwareSystemID is the ID of the software system this view with is // associated with. SoftwareSystemID string `json:"softwareSystemId"` }
ContextView describes a system context view.
func (*ContextView) AddAnimation ¶
func (cv *ContextView) AddAnimation(ehs []ElementHolder) error
AddAnimation adds the given animation steps to the view.
func (*ContextView) AddElements ¶
func (cv *ContextView) AddElements(ehs ...ElementHolder) error
AddElements adds the given elements to the view if not already present.
func (*ContextView) AddRelationships ¶
func (cv *ContextView) AddRelationships(rels ...*Relationship)
AddRelationships adds the given relationships to the view if not already present. It does nothing if the relationship source and destination are not already in the view.
func (*ContextView) Remove ¶
func (cv *ContextView) Remove(id string)
Remove given element from view if not software system this view is for.
type Decision ¶
type Decision struct { // ID of decision. ID string `json:"id"` // Date of decision in ISO 8601 format. Date string `json:"date"` // Status of decision. Decision DecisionStatusKind `json:"decision"` // Title of decision Title string `json:"title"` // Markdown or AsciiDoc content of decision. Content string `json:"content"` // Content format. Format DocFormatKind `json:"format"` // ID of element (in model) that decision applies to (optional). ElementID string `json:"elementId,omitempty"` }
Decision record (e.g. architecture decision record).
type DecisionStatusKind ¶
type DecisionStatusKind int
DecisionStatusKind is the enum used to represent status of decision.
const ( DecisionUndefined DecisionStatusKind = iota DecisionProposed DecisionAccepted DecisionSuperseded DecisionDeprecated DecisionRejected )
func (DecisionStatusKind) MarshalJSON ¶
func (d DecisionStatusKind) MarshalJSON() ([]byte, error)
MarshalJSON replaces the constant value with the proper string value.
func (*DecisionStatusKind) UnmarshalJSON ¶
func (d *DecisionStatusKind) UnmarshalJSON(data []byte) error
UnmarshalJSON sets the constant from its JSON representation.
type DeploymentEnvironment ¶
type DeploymentEnvironment struct { // Name of environment. Name string }
DeploymentEnvironment provides context to the other deployment expressions.
func (*DeploymentEnvironment) EvalName ¶
func (d *DeploymentEnvironment) EvalName() string
EvalName returns the generic expression name used in error messages.
type DeploymentNode ¶
type DeploymentNode struct { *Element // Environment is the deployment environment in which this deployment // node resides (e.g. "Development", "Live", etc). Environment string `json:"environment"` // Instances is the number of instances. Instances *int `json:"instances,omitempty"` // Children describe the child deployment nodes if any. Children []*DeploymentNode `json:"children,omitempty"` // Parent is the parent deployment node if any. Parent *DeploymentNode `json:"-"` // InfrastructureNodes describe the infrastructure nodes (load // balancers, firewall etc.) InfrastructureNodes []*InfrastructureNode `json:"infrastructureNodes,omitempty"` // ContainerInstances describe instances of containers deployed in // deployment node. ContainerInstances []*ContainerInstance `json:"containerInstances,omitempty"` }
DeploymentNode describes a single deployment node.
func (*DeploymentNode) AddChild ¶
func (d *DeploymentNode) AddChild(n *DeploymentNode) *DeploymentNode
AddChild adds the given child deployment node to the parent. If there is already a deployment node with the given name then AddChild merges both definitions. The merge algorithm:
- overrides the description, technology and URL if provided,
- merges any new tag or propery into the existing tags and properties,
- merges any new child deployment node into the existing children,
- merges any new container instance or infrastructure nodes into existing ones.
AddChild returns the new or merged deployment node.
func (*DeploymentNode) AddContainerInstance ¶
func (d *DeploymentNode) AddContainerInstance(ci *ContainerInstance) *ContainerInstance
AddContainerInstance adds the given container instance to the deployment node. If there is already a container instance with the given container and instance ID then AddContainerInstance merges both definitions. The merge algorithm:
- overrides the description, technology and URL if provided,
- merges any new tag or propery into the existing tags and properties,
- merges any new health check into the existing health checks.
AddContainerInstance returns the new or merged container instance.
func (*DeploymentNode) AddInfrastructureNode ¶
func (d *DeploymentNode) AddInfrastructureNode(n *InfrastructureNode) *InfrastructureNode
AddInfrastructureNode adds the given infrastructure node to the deployment node. If there is already an infrastructure node with the given name then AddInfrastructureNode merges both definitions. The merge algorithm:
- overrides the description, technology and URL if provided,
- merges any new tag or propery into the existing tags and properties.
AddInfrastructureNode returns the new or merged infrastructure node.
func (*DeploymentNode) Child ¶
func (d *DeploymentNode) Child(name string) *DeploymentNode
Child returns the child deployment node with the given name if any, nil otherwise.
func (*DeploymentNode) ContainerInstance ¶
func (d *DeploymentNode) ContainerInstance(container *Container, instanceID int) *ContainerInstance
ContainerInstance returns the container instance for the given container with the given instance ID if any, nil otherwise. container must be an instance of Container or the name of a container.
func (*DeploymentNode) EvalName ¶
func (d *DeploymentNode) EvalName() string
EvalName returns the generic expression name used in error messages.
func (*DeploymentNode) Finalize ¶
func (d *DeploymentNode) Finalize()
Finalize adds the 'Deployment Node' tag ands finalizes relationships.
func (*DeploymentNode) InfrastructureNode ¶
func (d *DeploymentNode) InfrastructureNode(name string) *InfrastructureNode
InfrastructureNode returns the infrastructure node with the given name if any, nil otherwise.
type DeploymentView ¶
type DeploymentView struct { *ViewProps // SoftwareSystemID is the ID of the software system this view with is // associated with if any. SoftwareSystemID string `json:"softwareSystemId,omitempty"` // The name of the environment that this deployment view is for (e.g. // "Development", "Live", etc). Environment string `json:"environment"` }
DeploymentView describes a deployment view.
func (*DeploymentView) AddAnimation ¶
func (dv *DeploymentView) AddAnimation(ehs []ElementHolder) error
AddAnimation adds the given animation steps to the view.
func (*DeploymentView) AddElements ¶
func (dv *DeploymentView) AddElements(ehs ...ElementHolder) error
AddElements adds the given elements to the view if not already present.
func (*DeploymentView) AddRelationships ¶
func (dv *DeploymentView) AddRelationships(rels ...*Relationship)
AddRelationships adds the given relationships to the view if not already present. It does nothing if the relationship source and destination are not already in the view.
func (*DeploymentView) Remove ¶
func (dv *DeploymentView) Remove(id string)
Remove given deployment node from view.
type DocFormatKind ¶
type DocFormatKind int
DocFormatKind is the enum used to represent documentation format.
const ( FormatUndefined DocFormatKind = iota FormatMarkdown FormatASCIIDoc )
func (DocFormatKind) MarshalJSON ¶
func (d DocFormatKind) MarshalJSON() ([]byte, error)
MarshalJSON replaces the constant value with the proper string value.
func (*DocFormatKind) UnmarshalJSON ¶
func (d *DocFormatKind) UnmarshalJSON(data []byte) error
UnmarshalJSON sets the constant from its JSON representation.
type Documentation ¶
type Documentation struct { // Documentation sections. Sections []*DocumentationSection `json:"sections,omitempty"` // ADR decisions. Decisions []*Decision `json:"decisions,omitempty"` // Images used in documentation. Images []*Image `json:"images,omitempty"` // Information about template used to render documentation. Template *DocumentationTemplateMetadata `json:"template,omitempty"` }
Documentation associated with software architecture model.
type DocumentationSection ¶
type DocumentationSection struct { // Title (name/section heading) of section. Title string `json:"title"` // Markdown or AsciiDoc content of section. Content string `json:"string"` // Content format. Format DocFormatKind `json:"format"` // Order (index) of section in document. Order int `json:"order"` // ID of element (in model) that section applies to (optional). ElementID string `json:"elementId,omitempty"` }
DocumentationSection corresponds to a documentation section.
type DocumentationTemplateMetadata ¶
type DocumentationTemplateMetadata struct { // Name of documentation template. Name string `json:"name"` // Name of author of documentation template. Author string `json:"author,omitempty"` // URL that points to more information about template. URL string `json:"url,omitempty"` }
DocumentationTemplateMetadata provides information about a documentation template used to create documentation.
type DynamicView ¶
type DynamicView struct { *ViewProps // ElementID is the identifier of the element this view is associated with. ElementID string `json:"elementId"` }
DynamicView describes a dynamic view for a specified scope.
func (*DynamicView) AddRelationships ¶
func (cv *DynamicView) AddRelationships(rels ...*Relationship)
AddRelationships adds the given relationships to the view if not already present. It does nothing if the relationship source and destination are not already in the view.
func (*DynamicView) Remove ¶
func (cv *DynamicView) Remove(id string)
Remove given element from view.
type Element ¶
type Element struct { // ID of element. ID string `json:"id"` // Name of element. Name string `json:"name,omitempty"` // Container instances don't have a name // Description of element if any. Description string `json:"description,omitempty"` // Technology used by element if any - not applicable to Person. Technology string `json:"technology,omitempty"` // Tags attached to element as comma separated list if any. Tags string `json:"tags,omitempty"` // URL where more information about this element can be found. URL string `json:"url,omitempty"` // Set of arbitrary name-value properties (shown in diagram tooltips). Properties map[string]string `json:"properties,omitempty"` // Rels is the set of relationships from this element to other elements. Rels []*Relationship `json:"relationships,omitempty"` // DSL to run. DSLFunc func() `json:"-"` }
Element describes an element.
func (*Element) Finalize ¶
func (e *Element) Finalize()
Finalize updates the relationship destinations.
func (*Element) GetElement ¶
GetElement returns the underlying element.
func (*Element) Reachable ¶
Reachable returns the IDs of all elements that can be reached by traversing the relationships from the given root.
func (*Element) RelatedComponents ¶
func (e *Element) RelatedComponents() (res Components)
RelatedComponents returns all components the element has a relationship with (either as source or as destination).
func (*Element) RelatedContainers ¶
func (e *Element) RelatedContainers() (res Containers)
RelatedContainers returns all containers the element has a relationship with (either as source or as destination).
func (*Element) RelatedPeople ¶
RelatedPeople returns all people the element has a relationship with (either as source or as destination).
func (*Element) RelatedSoftwareSystems ¶
func (e *Element) RelatedSoftwareSystems() (res SoftwareSystems)
RelatedSoftwareSystems returns all software systems the element has a relationship with (either as source or as destination).
type ElementHolder ¶
type ElementHolder interface {
GetElement() *Element
}
ElementHolder provides access to the underlying element.
type ElementStyle ¶
type ElementStyle struct { // Tag to which this style applies. Tag string `json:"tag,omitempty"` // Width of element, in pixels. Width *int `json:"width,omitempty"` // Height of element, in pixels. Height *int `json:"height,omitempty"` // Background color of element as HTML RGB hex string (e.g. "#ffffff") Background string `json:"background,omitempty"` // Stroke color of element as HTML RGB hex string (e.g. "#000000") Stroke string `json:"stroke,omitempty"` // Foreground (text) color of element as HTML RGB hex string (e.g. "#ffffff") Color string `json:"color,omitempty"` // Standard font size used to render text, in pixels. FontSize *int `json:"fontSize,omitempty"` // Shape used to render element. Shape ShapeKind `json:"shape,omitempty"` // URL of PNG/JPG/GIF file or Base64 data URI representation. Icon string `json:"icon,omitempty"` // Type of border used to render element. Border BorderKind `json:"border,omitempty"` // Opacity used to render element; 0-100. Opacity *int `json:"opacity,omitempty"` // Whether element metadata should be shown. Metadata *bool `json:"metadata,omitempty"` // Whether element description should be shown. Description *bool `json:"description,omitempty"` }
ElementStyle defines an element style.
func (*ElementStyle) EvalName ¶
func (es *ElementStyle) EvalName() string
EvalName returns the generic expression name used in error messages.
type ElementView ¶
type ElementView struct { // ID of element. ID string `json:"id"` // Horizontal position of element when rendered X *int `json:"x,omitempty"` // Vertical position of element when rendered. Y *int `json:"y,omitempty"` // Correpsonding model element. Element *Element `json:"-"` // Remove relationships before rendering. NoRelationship bool `json:"-"` }
ElementView describes an instance of a model element (Person, Software System, Container or Component) in a View.
func (*ElementView) EvalName ¶
func (v *ElementView) EvalName() string
EvalName returns the generic expression name used in error messages.
type Enterprise ¶
type Enterprise struct { // Name of enterprise. Name string `json:"name"` }
Enterprise describes a named enterprise / organization.
type FilteredView ¶
type FilteredView struct { // Title of the view. Title string `json:"title,omitempty"` // Description of view. Description string `json:"description,omitempty"` // Key used to refer to the view. Key string `json:"key"` // BaseKey is the key of the view on which this filtered view is based. BaseKey string `json:"baseViewKey"` // Whether elements/relationships are being included ("Include") or // excluded ("Exclude") based upon the set of tags. Mode string `json:"mode"` // The set of tags to include/exclude elements/relationships when // rendering this filtered view. Tags []string `json:"tags,omitempty"` }
FilteredView describes a filtered view on top of a specified view.
func (*FilteredView) EvalName ¶
func (fv *FilteredView) EvalName() string
EvalName returns the generic expression name used in error messages.
type Font ¶
type Font struct { // Name of font. Name string `json:"name,omitempty"` // Web font URL. URL string `json:"url,omitempty"` }
Font details including name and optional URL for web fonts.
type HealthCheck ¶
type HealthCheck struct { // Name of health check. Name string `json:"name"` // Health check URL/endpoint. URL string `json:"url"` // Polling interval, in seconds. Interval int `json:"interval"` // Timeout after which health check is deemed as failed, in milliseconds. Timeout int `json:"timeout"` // Set of name-value pairs corresponding to HTTP headers to be sent with request. Headers map[string]string `json:"headers"` }
HealthCheck is a HTTP-based health check.
func (*HealthCheck) EvalName ¶
func (hc *HealthCheck) EvalName() string
EvalName returns the generic expression name used in error messages.
type Image ¶
type Image struct { // Name of image. Name string `json:"image"` // Base64 encoded content. Content string `json:"content"` // Image MIME type (e.g. "image/png") Type string `json:"type"` }
Image represents a Base64 encoded image (PNG/JPG/GIF).
type InfrastructureNode ¶
type InfrastructureNode struct { *Element // Parent deployment node. Parent *DeploymentNode `json:"-"` // Environment is the deployment environment in which this // infrastructure node resides (e.g. "Development", "Live", // etc). Environment string `json:"environment"` }
InfrastructureNode describes an infrastructure node.
func (*InfrastructureNode) EvalName ¶
func (i *InfrastructureNode) EvalName() string
EvalName returns the generic expression name used in error messages.
func (*InfrastructureNode) Finalize ¶
func (i *InfrastructureNode) Finalize()
Finalize adds the 'Infrastructure Node' tag ands finalizes relationships.
type InteractionStyleKind ¶
type InteractionStyleKind int
InteractionStyleKind is the enum for possible interaction styles.
const ( // InteractionUndefined means no interaction style specified in design. InteractionUndefined InteractionStyleKind = iota // InteractionSynchronous describes a synchronous interaction. InteractionSynchronous // InteractionAsynchronous describes an asynchronous interaction. InteractionAsynchronous )
func (InteractionStyleKind) MarshalJSON ¶
func (i InteractionStyleKind) MarshalJSON() ([]byte, error)
MarshalJSON replaces the constant value with the proper string value.
func (*InteractionStyleKind) UnmarshalJSON ¶
func (i *InteractionStyleKind) UnmarshalJSON(data []byte) error
UnmarshalJSON sets the constant from its JSON representation.
type LandscapeView ¶
type LandscapeView struct { *ViewProps // EnterpriseBoundaryVisible specifies whether the enterprise boundary // (to differentiate internal elements from external elements) should be // visible on the resulting diagram. EnterpriseBoundaryVisible *bool `json:"enterpriseBoundaryVisible,omitempty"` }
LandscapeView describes a system landscape view.
func (*LandscapeView) AddAnimation ¶
func (cv *LandscapeView) AddAnimation(ehs []ElementHolder) error
AddAnimation adds the given animation steps to the view.
func (*LandscapeView) AddElements ¶
func (cv *LandscapeView) AddElements(ehs ...ElementHolder) error
AddElements adds the given elements to the view if not already present.
func (*LandscapeView) AddRelationships ¶
func (cv *LandscapeView) AddRelationships(rels ...*Relationship)
AddRelationships adds the given relationships to the view if not already present. It does nothing if the relationship source and destination are not already in the view.
func (*LandscapeView) Remove ¶
func (cv *LandscapeView) Remove(id string)
Remove given element from view.
type LocationKind ¶
type LocationKind int
LocationKind is the enum for possible locations.
const ( // LocationUndefined means no location specified in design. LocationUndefined LocationKind = iota // LocationInternal defines an element internal to the enterprise. LocationInternal // LocationExternal defines an element external to the enterprise. LocationExternal )
func (LocationKind) MarshalJSON ¶
func (l LocationKind) MarshalJSON() ([]byte, error)
MarshalJSON replaces the constant value with the proper string value.
func (*LocationKind) UnmarshalJSON ¶
func (l *LocationKind) UnmarshalJSON(data []byte) error
UnmarshalJSON sets the constant from its JSON representation.
type Model ¶
type Model struct { // Enterprise associated with model if any. Enterprise *Enterprise `json:"enterprise,omitempty"` // People lists Person elements. People People `json:"people,omitempty"` // Systems lists Software System elements. Systems SoftwareSystems `json:"softwareSystems,omitempty"` // DeploymentNodes list the deployment nodes. DeploymentNodes []*DeploymentNode `json:"deploymentNodes,omitempty"` // AddImpliedRelationships adds implied relationships automatically. AddImpliedRelationships bool `json:"-"` }
Model describes a software architecture model.
func (*Model) AddDeploymentNode ¶
func (m *Model) AddDeploymentNode(d *DeploymentNode) *DeploymentNode
AddDeploymentNode adds the given deployment node to the model. If there is already a deployment node with the given name then AddDeploymentNode merges both definitions. The merge algorithm:
- overrides the description, technology and URL if provided,
- merges any new tag or propery into the existing tags and properties,
- merges any new relationship into the existing relationships,
- merges any new child deployment node into the existing children,
- merges any new container instance or infrastructure nodes into existing ones.
AddDeploymentNode returns the new or merged deployment node.
func (*Model) AddPerson ¶
AddPerson adds the given person to the model. If there is already a person with the given name then AddPerson merges both definitions. The merge algorithm:
- overrides the description, technology and URL if provided,
- merges any new tag or propery into the existing tags and properties,
- merges any new relationship into the existing relationships.
AddPerson returns the new or merged person.
func (*Model) AddSystem ¶
func (m *Model) AddSystem(s *SoftwareSystem) *SoftwareSystem
AddSystem adds the given software system to the model. If there is already a software system with the given name then AddSystem merges both definitions. The merge algorithm:
- overrides the description, technology and URL if provided,
- merges any new tag or propery into the existing tags and properties,
- merges any new relationship into the existing relationships,
- merges any new container into the existing containers.
AddSystem returns the new or merged software system.
func (*Model) DeploymentNode ¶
func (m *Model) DeploymentNode(name string) *DeploymentNode
DeploymentNode returns the deployment node with the given name if any, nil otherwise.
func (*Model) Finalize ¶
func (m *Model) Finalize()
Finalize add all implied relationships if needed.
func (*Model) FindElement ¶
func (m *Model) FindElement(n string) ElementHolder
FindElement retrieves the element with the given name or nil if there isn't one.
func (*Model) SoftwareSystem ¶
func (m *Model) SoftwareSystem(name string) *SoftwareSystem
SoftwareSystem returns the software system with the given name if any, nil otherwise.
type PaperSizeKind ¶
type PaperSizeKind int
PaperSizeKind is the enum for possible paper kinds.
const ( SizeUndefined PaperSizeKind = iota SizeA0Landscape SizeA0Portrait SizeA1Landscape SizeA1Portrait SizeA2Landscape SizeA2Portrait SizeA3Landscape SizeA3Portrait SizeA4Landscape SizeA4Portrait SizeA5Landscape SizeA5Portrait SizeA6Landscape SizeA6Portrait SizeLegalLandscape SizeLegalPortrait SizeLetterLandscape SizeLetterPortrait SizeSlide16X10 SizeSlide16X9 SizeSlide4X3 )
func (PaperSizeKind) MarshalJSON ¶
func (p PaperSizeKind) MarshalJSON() ([]byte, error)
MarshalJSON replaces the constant value with the proper string value.
func (*PaperSizeKind) UnmarshalJSON ¶
func (p *PaperSizeKind) UnmarshalJSON(data []byte) error
UnmarshalJSON sets the constant from its JSON representation.
type People ¶
type People []*Person
People is a slide of Person that can easily be converted into a slice of ElementHolder.
func (People) Elements ¶
func (p People) Elements() []ElementHolder
Elements returns a slice of ElementHolder that contains the people.
type Person ¶
type Person struct { *Element // Location of person. Location LocationKind `json:"location"` }
Person represents a person.
type RankDirectionKind ¶
type RankDirectionKind int
RankDirectionKind is the enum for possible automatic layout rank directions.
const ( RankUndefined RankDirectionKind = iota RankTopBottom RankBottomTop RankLeftRight RankRightLeft )
func (RankDirectionKind) MarshalJSON ¶
func (r RankDirectionKind) MarshalJSON() ([]byte, error)
MarshalJSON replaces the constant value with the proper string value.
func (*RankDirectionKind) UnmarshalJSON ¶
func (r *RankDirectionKind) UnmarshalJSON(data []byte) error
UnmarshalJSON sets the constant from its JSON representation.
type Relationship ¶
type Relationship struct { // ID of relationship. ID string `json:"id"` // Description of relationship if any. Description string `json:"description"` // Tags attached to relationship as comma separated list if any. Tags string `json:"tags,omitempty"` // URL where more information can be found. URL string `json:"url,omitempty"` // SourceID is the ID of the source element. SourceID string `json:"sourceId"` // DestinationID is ID the destination element. DestinationID string `json:"destinationId"` // Technology associated with relationship. Technology string `json:"technology,omitempty"` // InteractionStyle describes whether the interaction is synchronous or asynchronous InteractionStyle InteractionStyleKind `json:"interactionStyle"` // ID of container-container relationship upon which this container // instance-container instance relationship is based. LinkedRelationshipID string `json:"linkedRelationshipId,omitempty"` // Source element. Source *Element `json:"-"` // Destination element. Destination *Element `json:"-"` // DestinationName element name. DestinationName string `json:"-"` }
Relationship describes a uni-directional relationship between two elements.
func (*Relationship) Dup ¶
func (r *Relationship) Dup(newSrc, newDest string) *Relationship
Dup creates a new relationship with identical description, tags, URL, technology and interaction style as r. Dup also creates a new ID for the result.
func (*Relationship) EvalName ¶
func (r *Relationship) EvalName() string
EvalName is the qualified name of the expression.
func (*Relationship) Finalize ¶
func (r *Relationship) Finalize()
Finalize computes the destinations when name is used to define relationship.
func (*Relationship) FindDestination ¶
func (r *Relationship) FindDestination() *Element
FindDestination computes the relationship destination.
func (*Relationship) MergeTags ¶
func (r *Relationship) MergeTags(tags ...string)
MergeTags adds the given tags. It skips tags already present in e.Tags.
func (*Relationship) Validate ¶
func (r *Relationship) Validate() error
Validate makes sure the named destination exists.
type RelationshipStyle ¶
type RelationshipStyle struct { // Tag to which this style applies. Tag string `json:"tag,omitempty"` // Thickness of line, in pixels. Thickness *int `json:"thickness,omitempty"` // Color of line as HTML RGB hex string (e.g. "#ffffff"). Color string `json:"color,omitempty"` // Standard font size used to render relationship annotation, in pixels. FontSize *int `json:"fontSize,omitempty"` // Width of relationship annotation, in pixels. Width *int `json:"width,omitempty"` // Whether line is rendered dashed or not. Dashed *bool `json:"dashed,omitempty"` // Routing algorithm used to render lines. Routing RoutingKind `json:"routing,omitempty"` // Position of annotation along the line; 0 (start) to 100 (end). Position *int `json:"position,omitempty"` // Opacity used to render line; 0-100. Opacity *int `json:"opacity,omitempty"` }
RelationshipStyle defines a relationship style.
func (*RelationshipStyle) EvalName ¶
func (rs *RelationshipStyle) EvalName() string
EvalName returns the generic expression name used in error messages.
type RelationshipView ¶
type RelationshipView struct { // ID of relationship. ID string `json:"id"` // Description of relationship used in dynamic views. Description string `json:"description,omitempty"` // Order of relationship in dynamic views. Order string `json:"order,omitempty"` // Set of vertices used to render relationship Vertices []*Vertex `json:"vertices,omitempty"` // Routing algorithm used to render relationship. Routing RoutingKind `json:"routing,omitempty"` // Position of annotation along line; 0 (start) to 100 (end). Position *int `json:"position,omitempty"` // Corresponding relationship. Relationship *Relationship `json:"-"` }
RelationshipView describes an instance of a model relationship in a view.
func (*RelationshipView) EvalName ¶
func (v *RelationshipView) EvalName() string
EvalName returns the generic expression name used in error messages.
type RoutingKind ¶
type RoutingKind int
RoutingKind is the enum for possible routing algorithms.
const ( RoutingUndefined RoutingKind = iota RoutingCurved RoutingDirect RoutingOrthogonal )
func (RoutingKind) MarshalJSON ¶
func (r RoutingKind) MarshalJSON() ([]byte, error)
MarshalJSON replaces the constant value with the proper string value.
func (*RoutingKind) UnmarshalJSON ¶
func (r *RoutingKind) UnmarshalJSON(data []byte) error
UnmarshalJSON sets the constant from its JSON representation.
type ShapeKind ¶
type ShapeKind int
ShapeKind is the enum used to represent shapes used to render elements.
func (ShapeKind) MarshalJSON ¶
MarshalJSON replaces the constant value with the proper string value.
func (*ShapeKind) UnmarshalJSON ¶
UnmarshalJSON sets the constant from its JSON representation.
type SoftwareSystem ¶
type SoftwareSystem struct { *Element // Location of element. Location LocationKind `json:"location"` // Containers list the containers within the software system. Containers Containers `json:"containers,omitempty"` }
SoftwareSystem represents a software system.
func (*SoftwareSystem) AddContainer ¶
func (s *SoftwareSystem) AddContainer(c *Container) *Container
AddContainer adds the given container to the software system. If there is already a container with the given name then AddContainer merges both definitions. The merge algorithm:
- overrides the description, technology and URL if provided,
- merges any new tag or propery into the existing tags and properties,
- merges any new relationship into the existing relationships,
- merges any new component into the existing components.
AddContainer returns the new or merged person.
func (*SoftwareSystem) Container ¶
func (s *SoftwareSystem) Container(name string) *Container
Container returns the container with the given name if any, nil otherwise.
func (*SoftwareSystem) EvalName ¶
func (s *SoftwareSystem) EvalName() string
EvalName returns the generic expression name used in error messages.
func (*SoftwareSystem) Finalize ¶
func (s *SoftwareSystem) Finalize()
Finalize adds the 'SoftwareSystem' tag ands finalizes relationships.
type SoftwareSystems ¶
type SoftwareSystems []*SoftwareSystem
SoftwareSystems is a slice of software system that can be easily converted into a slice of ElementHolder.
func (SoftwareSystems) Elements ¶
func (s SoftwareSystems) Elements() []ElementHolder
Elements returns a slice of ElementHolder that contains the elements of s.
type Styles ¶
type Styles struct { // Elements is the set of element styles. Elements []*ElementStyle `json:"elements,omitempty"` // Relationships is the set of relationship styles. Relationships []*RelationshipStyle `json:"relationships,omitempty"` }
Styles describe styles associated with set of views.
type SymbolKind ¶
type SymbolKind int
SymbolKind is the enum used to represent symbols used to render metadata.
const ( SymbolUndefined SymbolKind = iota SymbolSquareBrackets SymbolRoundBrackets SymbolCurlyBrackets SymbolAngleBrackets SymbolDoubleAngleBrackets SymbolNone )
func (SymbolKind) MarshalJSON ¶
func (s SymbolKind) MarshalJSON() ([]byte, error)
MarshalJSON replaces the constant value with the proper string value.
func (*SymbolKind) UnmarshalJSON ¶
func (s *SymbolKind) UnmarshalJSON(data []byte) error
UnmarshalJSON sets the constant from its JSON representation.
type Terminology ¶
type Terminology struct { // Terminology used when rendering enterprise boundaries. Enterprise string `json:"enterprise,omitempty"` // Terminology used when rendering people. Person string `json:"person,omitempty"` // Terminology used when rendering software systems. SoftwareSystem string `json:"softwareSystem,omitempty"` // Terminology used when rendering containers. Container string `json:"container,omitempty"` // Terminology used when rendering components. Component string `json:"component,omitempty"` // Terminology used when rendering code elements. Code string `json:"code,omitempty"` // Terminology used when rendering deployment nodes. DeploymentNode string `json:"deploymentNode,omitempty"` // Terminology used when rendering relationships. Relationship string `json:"relationship,omitempty"` }
Terminology used on diagrams.
type User ¶
type User struct { Username string `json:"username"` // Role of user, one of "ReadWrite" or "ReadOnly". Role string `json:"role"` }
User of Structurizr service.
type Vertex ¶
type Vertex struct { // Horizontal position of vertex when rendered. X int `json:"x"` // Vertical position of vertex when rendered. Y int `json:"y"` }
Vertex describes the x and y coordinate of a bend in a line.
type View ¶
type View interface { ElementView(string) *ElementView RelationshipView(string) *RelationshipView AllTagged(tag string) []*Element AllUnreachable(e ElementHolder) []*Element AddRelationships(...*Relationship) Remove(id string) Props() *ViewProps }
View is the common interface for all views.
type ViewAdder ¶
type ViewAdder interface { AddElements(...ElementHolder) error AddAnimation([]ElementHolder) error }
ViewAdder is the interface implemented by views that allow adding elements and animations explicitly.
type ViewLayout ¶ added in v1.0.4
type ViewLayout struct { Elements []*ElementView `json:"elements,omitempty"` Relationships []*RelationshipView `json:"relationships,omitempty"` }
ViewLayout contains the layout information for a given view.
type ViewProps ¶
type ViewProps struct { // Title of the view. Title string `json:"title,omitempty"` // Description of view. Description string `json:"description,omitempty"` // Key used to refer to the view. Key string `json:"key"` // PaperSize is the paper size that should be used to render this view. PaperSize PaperSizeKind `json:"paperSize,omitempty"` // AutoLayout describes the automatic layout mode for the diagram if // defined. AutoLayout *AutoLayout `json:"automaticLayout,omitempty"` // ElementViews list the elements included in the view. ElementViews []*ElementView `json:"elements,omitempty"` // RelationshipViews list the relationships included in the view. RelationshipViews []*RelationshipView `json:"relationships,omitempty"` // Animations describes the animation steps if any. Animations []*Animation `json:"animationSteps,omitempty"` }
ViewProps contains common properties of a view as well as helper methods to fetch them.
func (*ViewProps) AllUnreachable ¶
func (v *ViewProps) AllUnreachable(eh ElementHolder) (elts []*Element)
AllUnreachable fetches all elements in view related to the element (directly or not).
func (*ViewProps) AllUnrelated ¶
AllUnrelated fetches all elements that have no relationship to other elements in the view.
func (*ViewProps) ElementView ¶
func (v *ViewProps) ElementView(id string) *ElementView
ElementView returns the element view with the given ID if any.
func (*ViewProps) RelationshipView ¶
func (v *ViewProps) RelationshipView(id string) *RelationshipView
RelationshipView returns the relationship view with the given ID if any.
type Views ¶
type Views struct { // LandscapeViewss describe the system landscape views. LandscapeViews []*LandscapeView `json:"systemLandscapeViews,omitempty"` // ContextViews lists the system context views. ContextViews []*ContextView `json:"systemContextViews,omitempty"` // ContainerViews lists the container views. ContainerViews []*ContainerView `json:"containerViews,omitempty"` // ComponentViews lists the component views. ComponentViews []*ComponentView `json:"componentViews,omitempty"` // DynamicViews lists the dynamic views. DynamicViews []*DynamicView `json:"dynamicViews,omitempty"` // DeploymentViews lists the deployment views. DeploymentViews []*DeploymentView `json:"deploymentViews,omitempty"` // FilteredViews lists the filtered views. FilteredViews []*FilteredView `json:"filteredViews,omitempty"` // Styles contains the element and relationship styles. Configuration *Configuration `json:"configuration,omitempty"` // DSL to be run once all elements have been evaluated. DSLFunc func() `json:"-"` }
Views is the container for all views.
func (*Views) Packages ¶
Packages returns the import path to the Go packages that make up the DSL. This is used to skip frames that point to files in these packages when computing the location of errors.
type Workspace ¶
type Workspace struct { // ID of workspace. ID int `json:"id,omitempty"` // Name of workspace. Name string `json:"name"` // Description of workspace if any. Description string `json:"description,omitempty"` // Version number for the workspace. Version string `json:"version,omitempty"` // Revision number, automatically generated. Revision int `json:"revision,omitempty"` // Thumbnail associated with the workspace; a Base64 encoded PNG file as a // data URI (data:image/png;base64). Thumbnail string `json:"thumbnail,omitempty"` // The last modified date, in ISO 8601 format (e.g. "2018-09-08T12:40:03Z"). LastModifiedDate string `json:"lastModifiedDate,omitempty"` // A string identifying the user who last modified the workspace (e.g. an // e-mail address or username). LastModifiedUser string `json:"lastModifiedUser,omitempty"` // A string identifying the agent that was last used to modify the workspace // (e.g. "model-go/1.2.0"). LastModifiedAgent string `json:"lastModifiedAgent,omitempty"` // Model is the software architecture model. Model *Model `json:"model,omitempty"` // Views contains the views if any. Views *Views `json:"views,omitempty"` // Documentation associated with software architecture model. Documentation *Documentation `json:"documentation,omitempty"` // Configuration of workspace. Configuration *WorkspaceConfiguration `json:"configuration,omitempty"` }
Workspace describes a workspace and is the root expression of the plugin.
func (*Workspace) ApplyLayout ¶ added in v1.0.4
func (w *Workspace) ApplyLayout(layout WorkspaceLayout)
ApplyLayout merges the layout into the views of w.
func (*Workspace) DeploymentNode ¶
func (w *Workspace) DeploymentNode(name string) *DeploymentNode
DeploymentNode returns the deployment node with the given name if any, nil otherwise.
func (*Workspace) Layout ¶ added in v1.0.4
func (w *Workspace) Layout() WorkspaceLayout
Layout returns the workspace layout. It makes sure to only return relevant data. That is the entries in the layout all have at least one non-default field value (X or Y not 0 for elements, position not 0 or routing not undefined or vertices exist for relationships).
func (*Workspace) MergeLayout ¶
MergeLayout merges the layout of elements and relationships in the views of remote into the views of w. The merge algorithm matches elements by name and relationships by matching source, destination and description (i.e. IDs don't have to be identical).
func (*Workspace) Packages ¶
Packages returns the import path to the Go packages that make up the DSL. This is used to skip frames that point to files in these packages when computing the location of errors.
func (*Workspace) SoftwareSystem ¶
func (w *Workspace) SoftwareSystem(name string) *SoftwareSystem
SoftwareSystem returns the software system with the given name if any, nil otherwise.
type WorkspaceConfiguration ¶
type WorkspaceConfiguration struct { // Users that have access to the workspace. Users []*User `json:"users"` }
WorkspaceConfiguration describes the workspace configuration.
type WorkspaceLayout ¶ added in v1.0.4
type WorkspaceLayout map[string]*ViewLayout
WorkspaceLayout describes the view layouts of a workspace. The layout information includes element positions and relationship styles and vertices and is indexed by view keys.