puml

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Main              = "main"
	ClassModifier     = "class"
	InterfaceModifier = "interface"
	PublicModifier    = "+"
	PrivateModifier   = "-"
	StaticModifier    = "{static}"
	FieldModifier     = "{field}"
	MethodModifier    = "{method}"
	PrototypeArea     = "..prototype.."
	ConstArea         = "..const.."
	VarArea           = "..var.."
	FuncArea          = "..func.."
	FieldArea         = "..field.."
	MethodArea        = "..method.."
	SupperArea        = "..supper.."
	ConstructorArea   = "..constructor.."
	ScopeArea         = "==scope=="
	SPkgHeader        = "package %s {"
)

Variables

This section is empty.

Functions

func AstFuncString

func AstFuncString(fc *ast.FuncType, pkgName, fcName string) string

func AstValueSpecString

func AstValueSpecString(spec ast.Spec, sep string) string

func DepString

func DepString(a, b, indent string, kind DepKind) string

func DocFuncString

func DocFuncString(fc *doc.Func, pkgName string) string

func DocFuncsStrings

func DocFuncsStrings(fcs []*doc.Func, indent, pkgName string) string

func DocGlobalScopeString

func DocGlobalScopeString(cons []*doc.Value, vrs []*doc.Value, fcs []*doc.Func, indentHead, PkgNumberName string) string

func DocTypeString

func DocTypeString(dtyp *doc.Type, indentHead string, PkgNumberName string) string

func DocValuesStrings

func DocValuesStrings(values []*doc.Value, indent, sep string) string

func EscapeString

func EscapeString(text string) string

func InterfaceFieldsStrings

func InterfaceFieldsStrings(ityp *ast.InterfaceType, indent string) (supers, methods []string)

func SelectorTail

func SelectorTail(PkgNumberName string) string

func StructFieldsStrings

func StructFieldsStrings(styp *ast.StructType, indent string) (supers, fields []string)

Types

type DepKind

type DepKind int
const (
	SupperWeek DepKind = 1 << iota
	SupperStrong
	SpecWeek
	SpecStrong
	ArrayWeek
	ArrayStrong
)

func (DepKind) IsStrong

func (k DepKind) IsStrong() bool

type DepPackage

type DepPackage struct {
	Dir     string
	Pkg     *doc.Package           // 包
	Scope   map[string]*ast.Object // 包域环境值
	DepsMap map[string][]*DepSpec  // 类的依赖列表
}

func (*DepPackage) AddDepSpec

func (d *DepPackage) AddDepSpec(name string, depSpec *DepSpec)

type DepSpec

type DepSpec struct {
	ID    string
	Value ast.Expr
	Kind  DepKind
}

func NewDepSpec

func NewDepSpec(expr ast.Expr, isSupper bool, isWeek bool) (depSpec *DepSpec)

func ParseDep

func ParseDep(expr ast.Expr, isArrayed bool, isWeek bool) *DepSpec

ParseDep 解析依赖信息

type InterfaceSpec

type InterfaceSpec struct {
	Value ast.Spec
	Pkg   string
	Dir   string
}

type Portrait

type Portrait struct {
	Rootdir       string
	Excldirs      []string
	DepPkgs       []*DepPackage
	DirPkgMap     map[string]*DepPackage
	DirsMap       map[string][]string
	InterfaceList []InterfaceSpec
	NoScope       []string
	NoBuild       []string
	Puml          string
	// contains filtered or unexported fields
}

func NewPortrait

func NewPortrait(rootdir string, excldirs []string) *Portrait

func (*Portrait) ClassUniqueName

func (p *Portrait) ClassUniqueName(pkgName, dir, clss string) string

ClassUniqueName - 生成含固定唯一包前缀的类名,若不指定dir将跳过包名生成逻辑

func (*Portrait) DrawPuml

func (p *Portrait) DrawPuml()

DrawPuml - 线程保护生成puml文本

func (*Portrait) IndentWithPreDirs

func (p *Portrait) IndentWithPreDirs(i int, dir string) (indent0, indent1 string, preDirs []string)

IndentWithPreDirs - 基于当前DepPkg的索引计算缩进和父路径列表

func (*Portrait) PkgUniqueName

func (p *Portrait) PkgUniqueName(pkgName, dir string) string

PkgUniqueName - 生成包的固定唯一名,解决多个同名包问题

func (*Portrait) Scan

func (p *Portrait) Scan()

Jump to

Keyboard shortcuts

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