arch

package
v0.0.0-...-fceed96 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package arch implements gathering component information and links.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractAnnotation

func ExtractAnnotation(gen *ast.GenDecl, ts *ast.TypeSpec) (comment, tag string, ok bool)

ExtractAnnotation extracts architecture annotations from a type definition.

Types

type Component

type Component struct {
	Obj  types.Object
	Type types.Type

	// Links contains a list of components that it is linked to
	Links []*Link

	// Class is the functional categorization of the component.
	Class string
	// Comment has the type documentation.
	Comment string
}

Component is a architectural piece that is related to other pieces.

func (*Component) Add

func (node *Component) Add(link *Link)

Add adds a dependency to the component.

func (*Component) Name

func (node *Component) Name() string

Name returns the fully qualified name of the component.

func (*Component) Package

func (node *Component) Package() string

Package returns the package name.

func (*Component) ShortName

func (node *Component) ShortName() string

ShortName returns name without package.

func (*Component) String

func (node *Component) String() string

String creates a short description of the component that is useful for debugging.

type Link struct {
	Path   string
	Target *Component

	Implementation bool
}

Link is a connection to another component.

func NewImplLink(target *Component) *Link

NewImplLink creates a new link.

func NewLink(path string, target *Component) *Link

NewLink creates a new link.

type World

type World struct {
	ByType     map[types.Type]*Component
	Components []*Component
}

World contains the component and relation information.

func Analyze

func Analyze(pkgs ...*packages.Package) *World

Analyze analyzes packages and extracts architecture annotations and relations.

func NewWorld

func NewWorld() *World

NewWorld creates a new world.

func (*World) Add

func (world *World) Add(n *Component)

Add adds a new component to world.

func (*World) String

func (world *World) String() string

String creates a short description of the world that is useful for debugging.

Jump to

Keyboard shortcuts

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