model

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2023 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 Component

type Component struct {
	ID          string
	Kind        string
	Name        string
	Description string
	Technology  string
	Tags        []string
}

Component is an open structure that represents details of scraped component.

ID is a unique identifier of the component. Kind is a type that reflects component level in terms of C4 diagrams. Name is a component name. Description explains the responsibility of the component. Technology describes technology that the component is based on. Tags is a set of generic string tags that may be used as reference to a group of components.

type HasInfo

type HasInfo interface {
	Info() Info
}

HasInfo wraps simple getter method returning component information.

HasInfo interface informs that the type is able to provide component information on its own. All the types that implement the interface are automatically detected by default implementation of the scraper.

type Info

type Info struct {
	Name        string
	Kind        string
	Description string
	Technology  string
	Tags        []string
}

Info struct contains all component information details.

Name is a component name. Kind is a type that reflects component level in terms of C4 diagrams. Description explains the responsibility of the component. Technology describes technology that the component is based on. Tags is a set of generic string tags that may be used as reference to a group of components.

func ComponentInfo

func ComponentInfo(s ...string) Info

ComponentInfo instantiates a new component of predefined kind "component". Variadic arguments are assigned to the rest of Info properties one-by-one.

func (Info) IsZero

func (i Info) IsZero() bool

IsZero informs if the component is empty. If component has no kind specified it is considered as empty.

type Structure

type Structure struct {
	Components map[string]Component
	Relations  map[string]map[string]struct{}
}

Structure is an open stricture that represents whole scraped structure.

Components contains all the scraped components by its IDs. Relations contains all the connections between components by its IDs.

func NewStructure

func NewStructure() Structure

NewStructure instantiates an empty structure.

func (Structure) AddComponent

func (s Structure) AddComponent(c Component, parentID string)

AddComponent adds component and corresponding relation to its parent.

In case a parent of given ID does not exist relation will not be created.

func (Structure) Checksum

func (s Structure) Checksum() (string, error)

Checksum returns a hash of the Structure

Checksum may be used for tracking changes between the structures.

Jump to

Keyboard shortcuts

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