model

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2018 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Overview

Package model contains structures and constructors used by anticycle analyze functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Analysis

type Analysis struct {
	Cycles   []*Pkg        `json:"cycles"`
	Metadata *AnalysisMeta `json:"metadata"`
}

Analysis holds final anticycle output.

type AnalysisMeta

type AnalysisMeta struct {
	Cycles [][]string `json:"cycles"`
}

AnalysisMeta is a metadata produced based on Analysis.

type Cycle

type Cycle struct {
	AffectedImport *ImportInfo `json:"affectedImport"`
	AffectedFile   string      `json:"affectedFile"`
}

Cycle holds information about affected file and import

type File

type File struct {
	Path    string        `json:"path"`
	Imports []*ImportInfo `json:"imports"`
}

File is a representation of source file with its path and list of imports.

func NewFile

func NewFile() *File

NewFile creates new File with empty imports array. Will return pointer to File structure.

type ImportInfo

type ImportInfo struct {
	Name      string  `json:"name"`
	NameShort string  `json:"nameShort"`
	Alias     *string `json:"alias"`
}

ImportInfo holds information about import statements.

func NewImportInfo

func NewImportInfo(imp *ast.ImportSpec) *ImportInfo

NewImportInfo creates new ImportInfo from ast.ImportSpec. Will produce full name, short name and alias if exist.

type Pkg

type Pkg struct {
	Name      string                 `json:"name"`
	Path      string                 `json:"path"`
	Imports   map[string]*ImportInfo `json:"imports"`
	Files     []*File                `json:"files"`
	Cycles    []*Cycle               `json:"cycles,omitempty"`
	HaveCycle bool                   `json:"haveCycle"`
}

Pkg is a higher level structure which has all information about its files and imports.

func NewPkg

func NewPkg() *Pkg

NewPkg creates new Pkg with empty imports, files and cycles arrays. Will return pointer to Pkg structure.

Jump to

Keyboard shortcuts

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