config

package
v0.14.6 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2023 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultBaseColor = "#4B75B9"
View Source
const DefaultDocPath = "archdoc"
View Source
const DefaultFormat = "svg"

DefaultFormat is the default view format

View Source
const DefaultTextColor = "#333333"
View Source
const Esc = "\\"
View Source
const IconHeight = 80.0
View Source
const IconWidth = 80.0
View Source
const Q = "?"
View Source
const Sep = ":"

Variables

View Source
var DefaultConfigFilePaths = []string{"ndiag.yml"}
View Source
var DefaultDescPath = "ndiag.descriptions"
View Source
var DefaultIconPath = "ndiag.icons"
View Source
var RelationTypeDefault = &RelationType{
	Name:          "relation",
	ComponentsKey: "components",
	Attrs: Attrs{
		&Attr{
			Key:   "color",
			Value: "#4B75B9",
		},
		&Attr{
			Key:   "arrowhead",
			Value: "dot",
		},
		&Attr{
			Key:   "arrowhead",
			Value: "dot",
		},
		&Attr{
			Key:   "style",
			Value: "bold,dashed",
		},
	},
}
View Source
var RelationTypeNetwork = &RelationType{
	Name:          "network",
	ComponentsKey: "route",
	Attrs: Attrs{
		&Attr{
			Key:   "color",
			Value: "#33333399",
		},
		&Attr{
			Key:   "arrowhead",
			Value: "normal",
		},
		&Attr{
			Key:   "arrowhead",
			Value: "normal",
		},
		&Attr{
			Key:   "style",
			Value: "bold",
		},
	},
}

Functions

func MakeDiagramFilename added in v0.12.0

func MakeDiagramFilename(prefix, id, format string) string

func MakeMdFilename added in v0.12.0

func MakeMdFilename(prefix, id string) string

Types

type Attr added in v0.1.0

type Attr struct {
	Key   string
	Value string
}

Attr is attribute of ndiag element/edge

type Attrs added in v0.14.0

type Attrs []*Attr

func (Attrs) FindByKey added in v0.14.0

func (attrs Attrs) FindByKey(key string) (*Attr, error)

func (Attrs) Merge added in v0.14.0

func (dest Attrs) Merge(src Attrs) Attrs

type Cluster

type Cluster struct {
	Layer      *Layer
	Name       string
	Desc       string
	Parent     *Cluster
	Children   Clusters
	Nodes      Nodes
	Components Components
	Metadata   ClusterMetadata
}

func (*Cluster) DescFilename added in v0.12.0

func (c *Cluster) DescFilename() string

func (*Cluster) ElementType added in v0.12.0

func (c *Cluster) ElementType() ElementType

func (*Cluster) FullName

func (c *Cluster) FullName() string

func (*Cluster) Id

func (c *Cluster) Id() string

func (*Cluster) OverrideMetadata added in v0.9.0

func (c *Cluster) OverrideMetadata(c2 *Cluster) error

type ClusterMetadata added in v0.7.0

type ClusterMetadata struct {
	Icon      string      `qs:"icon"`
	Color     color.Color `qs:"-"`
	FillColor color.Color `qs:"-"`
	TextColor color.Color `qs:"-"`
}

type Clusters

type Clusters []*Cluster

func (Clusters) Contains added in v0.10.0

func (cs Clusters) Contains(t *Cluster) bool

func (Clusters) Find

func (cs Clusters) Find(layer, name string) *Cluster

func (Clusters) FindById added in v0.14.0

func (cs Clusters) FindById(id string) (*Cluster, error)

func (Clusters) FindByLayer

func (cs Clusters) FindByLayer(layer string) Clusters

type ColorSet added in v0.7.0

type ColorSet struct {
	Color, FillColor, TextColor color.Color
}

type ColorSets added in v0.7.0

type ColorSets []ColorSet

func (ColorSets) Get added in v0.7.0

func (s ColorSets) Get(i int) ColorSet

type Component

type Component struct {
	Name     string
	Desc     string
	Cluster  *Cluster
	Node     *Node
	Edges    []*Edge
	Labels   Labels
	Metadata ComponentMetadata
}

func (*Component) DescFilename added in v0.12.0

func (c *Component) DescFilename() string

func (*Component) ElementType added in v0.12.0

func (c *Component) ElementType() ElementType

func (*Component) FullName

func (c *Component) FullName() string

func (*Component) Id

func (c *Component) Id() string

func (*Component) OverrideMetadata added in v0.7.1

func (c *Component) OverrideMetadata(c2 *Component) error

type ComponentMetadata added in v0.7.0

type ComponentMetadata struct {
	Icon   string   `qs:"icon"`
	Labels []string `qs:"label"`
}

type Components added in v0.12.0

type Components []*Component

func (Components) FindById added in v0.12.0

func (components Components) FindById(id string) (*Component, error)

type Config

type Config struct {
	Name          string      `yaml:"name"`
	Desc          string      `yaml:"desc,omitempty"`
	DocPath       string      `yaml:"docPath"`
	DescPath      string      `yaml:"descPath,omitempty"`
	IconPath      string      `yaml:"iconPath,omitempty"`
	Graph         *Graph      `yaml:"graph,omitempty"`
	HideViews     bool        `yaml:"hideViews,omitempty"`
	HideLayers    bool        `yaml:"hideLayers,omitempty"`
	HideRealNodes bool        `yaml:"hideRealNodes,omitempty"`
	HideLabels    bool        `yaml:"hideLabels,omitempty"`
	Views         Views       `yaml:"views"`
	Nodes         Nodes       `yaml:"nodes"`
	Relations     Relations   `yaml:"relations,omitempty"`
	Dict          *dict.Dict  `yaml:"dict,omitempty"`
	BaseColor     string      `yaml:"baseColor,omitempty"`
	TextColor     string      `yaml:"textColor,omitempty"`
	CustomIcons   CustomIcons `yaml:"customIcons,omitempty"`
	// contains filtered or unexported fields
}

func New

func New() *Config

func (*Config) Build

func (cfg *Config) Build() error

func (*Config) BuildForIcons added in v0.9.0

func (cfg *Config) BuildForIcons() error

func (*Config) BuildNestedClusters

func (cfg *Config) BuildNestedClusters(layers []string) (Clusters, Nodes, []*Edge, error)

func (*Config) ClusterComponents

func (cfg *Config) ClusterComponents() Components

func (*Config) Clusters

func (cfg *Config) Clusters() Clusters

func (*Config) ColorSets added in v0.7.0

func (cfg *Config) ColorSets() ColorSets

func (*Config) Components added in v0.10.0

func (cfg *Config) Components() Components

func (*Config) Edges added in v0.10.0

func (cfg *Config) Edges() []*Edge

func (*Config) Elements added in v0.12.0

func (cfg *Config) Elements() []Element

func (*Config) FindComponent

func (cfg *Config) FindComponent(s string) (*Component, error)

func (*Config) FindLabel added in v0.8.0

func (cfg *Config) FindLabel(name string) (*Label, error)

func (*Config) FindLayer added in v0.7.0

func (cfg *Config) FindLayer(s string) (*Layer, error)

func (*Config) FindNode added in v0.2.0

func (cfg *Config) FindNode(name string) (*Node, error)

func (*Config) FindOrCreateLabel added in v0.10.0

func (cfg *Config) FindOrCreateLabel(name string) *Label

func (*Config) Format added in v0.6.0

func (cfg *Config) Format() string

func (*Config) GlobalComponents

func (cfg *Config) GlobalComponents() Components

func (*Config) HideDetails added in v0.14.0

func (cfg *Config) HideDetails() error

func (*Config) IconMap added in v0.7.0

func (cfg *Config) IconMap() *IconMap

func (*Config) Labels added in v0.8.0

func (cfg *Config) Labels() Labels

func (*Config) Layers

func (cfg *Config) Layers() []*Layer

func (*Config) LoadConfigFile

func (cfg *Config) LoadConfigFile(path string) error

func (*Config) LoadRealNodes

func (cfg *Config) LoadRealNodes(in []byte) error

func (*Config) LoadRealNodesFile

func (cfg *Config) LoadRealNodesFile(path string) error

func (*Config) Merge added in v0.14.0

func (dest *Config) Merge(src *Config) (err error)

func (*Config) NodeComponents

func (cfg *Config) NodeComponents() Components

func (*Config) PrimaryView added in v0.10.0

func (cfg *Config) PrimaryView() *View

func (*Config) PruneClustersByLabels added in v0.8.0

func (cfg *Config) PruneClustersByLabels(clusters Clusters, globalNodes Nodes, globalComponents Components, edges []*Edge, labels []string) (Clusters, Nodes, Components, []*Edge, error)

func (*Config) PruneClustersByRelations added in v0.12.0

func (cfg *Config) PruneClustersByRelations(clusters Clusters, globalNodes Nodes, globalComponents Components, relations Relations) (Clusters, Nodes, Components, []*Edge, error)

func (*Config) PruneNodesByLabels added in v0.8.0

func (cfg *Config) PruneNodesByLabels(nodes Nodes, labelStrs []string) (Nodes, error)

func (*Config) UnmarshalYAML

func (d *Config) UnmarshalYAML(data []byte) error

type CustomIcons added in v0.14.0

type CustomIcons []*glyph.Blueprint

func (CustomIcons) FindByKey added in v0.14.0

func (icons CustomIcons) FindByKey(key string) (*glyph.Blueprint, error)

func (CustomIcons) Merge added in v0.14.0

func (dest CustomIcons) Merge(src CustomIcons) CustomIcons

type Edge

type Edge struct {
	Src      *Component
	Dst      *Component
	Desc     string
	Relation *Relation
	Attrs    Attrs
}

Edge is ndiag edge

func MergeEdges added in v0.1.0

func MergeEdges(edges []*Edge) []*Edge

func SplitRelations added in v0.4.0

func SplitRelations(relations Relations) []*Edge

type Element added in v0.10.0

type Element interface {
	ElementType() ElementType
	Id() string
	FullName() string
	DescFilename() string
}

Element is ndiag element

type ElementType added in v0.12.0

type ElementType int
const (
	TypeNode ElementType = iota + 1
	TypeComponent
	TypeRelation
	TypeLayer
	TypeCluster
	TypeLabel
	TypeView
)

func (ElementType) String added in v0.12.0

func (v ElementType) String() string

type Graph added in v0.6.0

type Graph struct {
	Format string
	Attrs  Attrs
}

func (*Graph) Merge added in v0.14.0

func (dest *Graph) Merge(src *Graph) (err error)

func (*Graph) UnmarshalYAML added in v0.14.0

func (g *Graph) UnmarshalYAML(data []byte) error

type Icon added in v0.9.0

type Icon struct {
	Path  string
	Glyph *glyph.Glyph
}

func (*Icon) IsGlyph added in v0.9.0

func (i *Icon) IsGlyph() bool

type IconMap added in v0.9.0

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

func NewIconMap added in v0.9.0

func NewIconMap(tempIconDir string) *IconMap

func (*IconMap) GeneratePNGGlyphIcons added in v0.9.0

func (m *IconMap) GeneratePNGGlyphIcons() (e error)

func (*IconMap) GenerateSVGGlyphIcons added in v0.9.0

func (m *IconMap) GenerateSVGGlyphIcons() (e error)

func (*IconMap) Get added in v0.9.0

func (m *IconMap) Get(k string) (*Icon, error)

func (*IconMap) Keys added in v0.9.0

func (m *IconMap) Keys() []string

func (*IconMap) RemoveTempIconDir added in v0.9.0

func (m *IconMap) RemoveTempIconDir() error

func (*IconMap) Set added in v0.9.0

func (m *IconMap) Set(k string, i *Icon)

type Label added in v0.8.0

type Label struct {
	Name string
	Desc string
}

func (*Label) DescFilename added in v0.12.0

func (l *Label) DescFilename() string

func (*Label) ElementType added in v0.12.0

func (l *Label) ElementType() ElementType

func (*Label) FullName added in v0.8.0

func (l *Label) FullName() string

func (*Label) Id added in v0.8.0

func (l *Label) Id() string

type Labels added in v0.10.0

type Labels []*Label

func (Labels) FindById added in v0.14.0

func (labels Labels) FindById(id string) (*Label, error)

func (Labels) Sort added in v0.10.0

func (labels Labels) Sort()

func (Labels) Subtract added in v0.10.0

func (labels Labels) Subtract(labels2 Labels) Labels

type Layer

type Layer struct {
	Name     string
	Desc     string
	Metadata LayerMetadata
}

func (*Layer) DescFilename added in v0.12.0

func (l *Layer) DescFilename() string

func (*Layer) ElementType added in v0.12.0

func (l *Layer) ElementType() ElementType

func (*Layer) FullName added in v0.11.0

func (l *Layer) FullName() string

func (*Layer) Id added in v0.11.0

func (l *Layer) Id() string

func (*Layer) String added in v0.7.0

func (l *Layer) String() string

type LayerMetadata added in v0.7.0

type LayerMetadata struct {
	Color     color.Color
	FillColor color.Color
	TextColor color.Color
}

type Node

type Node struct {
	Name        string       `yaml:"name"`
	Desc        string       `yaml:"desc,omitempty"`
	Match       string       `yaml:"match,omitempty"`
	MatchRegexp string       `yaml:"matchRegexp,omitempty"`
	Components  Components   `yaml:"components,omitempty"`
	Clusters    Clusters     `yaml:"clusters,omitempty"`
	Metadata    NodeMetadata `yaml:"metadata,omitempty"`
	RealNodes   RealNodes    `yaml:"-"`
	Labels      Labels
	// contains filtered or unexported fields
}

func (*Node) DescFilename added in v0.12.0

func (n *Node) DescFilename() string

func (*Node) ElementType added in v0.12.0

func (n *Node) ElementType() ElementType

func (*Node) FullName

func (n *Node) FullName() string

func (*Node) Id

func (n *Node) Id() string

func (*Node) OverrideMetadata added in v0.14.0

func (n *Node) OverrideMetadata(n2 *Node) error

func (*Node) UnmarshalYAML

func (n *Node) UnmarshalYAML(data []byte) error

type NodeMetadata added in v0.7.0

type NodeMetadata struct {
	Icon   string   `yaml:"icon,omitempty"`
	Labels []string `yaml:"labels,omitempty"`
}

type Nodes added in v0.14.0

type Nodes []*Node

func (Nodes) FindById added in v0.14.0

func (nodes Nodes) FindById(id string) (*Node, error)

func (Nodes) Merge added in v0.14.0

func (dest Nodes) Merge(src Nodes) (Nodes, error)

type RealNode

type RealNode struct {
	Node
	BelongTo *Node
}

type RealNodes added in v0.14.0

type RealNodes []*RealNode

func (RealNodes) FindById added in v0.14.0

func (nodes RealNodes) FindById(id string) (*RealNode, error)

type Relation added in v0.4.0

type Relation struct {
	Desc       string
	Type       *RelationType
	Components Components
	Labels     Labels
	Attrs      Attrs
	// contains filtered or unexported fields
}

func (*Relation) DescFilename added in v0.12.0

func (r *Relation) DescFilename() string

func (*Relation) ElementType added in v0.12.0

func (r *Relation) ElementType() ElementType

func (*Relation) FullName added in v0.4.0

func (r *Relation) FullName() string

func (*Relation) Id added in v0.4.0

func (r *Relation) Id() string

type RelationType added in v0.4.0

type RelationType struct {
	Name          string
	ComponentsKey string
	Attrs         Attrs
}

type Relations added in v0.11.0

type Relations []*Relation

func (Relations) FindByLabels added in v0.11.0

func (relations Relations) FindByLabels(labels Labels) Relations

type View added in v0.10.0

type View struct {
	Name   string   `yaml:"name"`
	Desc   string   `yaml:"desc,omitempty"`
	Layers []string `yaml:"layers"`
	Labels []string `yaml:"labels,omitempty"`
}

func (*View) DescFilename added in v0.12.0

func (v *View) DescFilename() string

func (*View) ElementType added in v0.12.0

func (v *View) ElementType() ElementType

func (*View) FullName added in v0.10.0

func (v *View) FullName() string

func (*View) Id added in v0.10.0

func (v *View) Id() string

type Views added in v0.14.0

type Views []*View

func (Views) FindById added in v0.14.0

func (views Views) FindById(id string) (*View, error)

func (Views) Merge added in v0.14.0

func (dest Views) Merge(src Views) Views

Jump to

Keyboard shortcuts

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