Documentation ¶
Index ¶
- Constants
- func FuncGraph2FileGraph(f graph.Graph[string, *Vertex], g graph.Graph[string, *file.Vertex]) error
- type FactStorage
- type FgStorage
- type FuncPos
- type Graph
- func CreateFuncGraph(fact *FactStorage, relationship *object.SourceContext) (*Graph, error)
- func CreateFuncGraphFromDirWithLSIF(src string, lsifFile string, lang core.LangType) (*Graph, error)
- func CreateFuncGraphFromDirWithSCIP(src string, scipFile string, lang core.LangType) (*Graph, error)
- func CreateFuncGraphFromGolangDir(src string) (*Graph, error)
- func Load(fgs *FgStorage) (*Graph, error)
- func LoadFile(fp string) (*Graph, error)
- func NewEmptyFuncGraph() *Graph
- func (fg *Graph) DirectReferenceIds(f *Vertex) []string
- func (fg *Graph) DirectReferencedCount(f *Vertex) int
- func (fg *Graph) DirectReferencedIds(f *Vertex) []string
- func (fg *Graph) DrawDot(filename string) error
- func (fg *Graph) DrawG6Html(filename string) error
- func (fg *Graph) Dump() (*FgStorage, error)
- func (fg *Graph) DumpFile(fp string) error
- func (fg *Graph) EntryIds(f *Vertex) []string
- func (fg *Graph) FileCount() int
- func (fg *Graph) FillWithOrange(vertexHash string) error
- func (fg *Graph) FillWithRed(vertexHash string) error
- func (fg *Graph) FillWithYellow(vertexHash string) error
- func (fg *Graph) FilterFunctions(f func(*Vertex) bool) []*Vertex
- func (fg *Graph) FuncCount() int
- func (fg *Graph) GetById(id string) (*Vertex, error)
- func (fg *Graph) GetFunctionsByFile(fileName string) []*Vertex
- func (fg *Graph) GetFunctionsByFileLines(fileName string, lines []int) []*Vertex
- func (fg *Graph) GlobalStat(points []*Vertex) *object.StatGlobal
- func (fg *Graph) ListEntries() []*Vertex
- func (fg *Graph) ListFiles() []string
- func (fg *Graph) ListFunctions() []*Vertex
- func (fg *Graph) RelationBetween(a string, b string) (*common.EdgeStorage, error)
- func (fg *Graph) RemoveNodeById(funcId string) error
- func (fg *Graph) Stat(f *Vertex) *object.ImpactUnit
- func (fg *Graph) ToDirGraph() (*file.Graph, error)
- func (fg *Graph) ToFileGraph() (*file.Graph, error)
- func (fg *Graph) ToG6Data() (*g6.Data, error)
- func (fg *Graph) TransitiveReferenceIds(f *Vertex) []string
- func (fg *Graph) TransitiveReferencedIds(f *Vertex) []string
- type Vertex
Constants ¶
const ( TagYellow = "yellow" TagRed = "red" TagOrange = "orange" )
const (
TagEntry = "entry"
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type FactStorage ¶
type FactStorage struct {
// contains filtered or unexported fields
}
FactStorage fact is some extra metadata extracted from source code something like: function definitions with their annotations/params/receiver ... these data can be used for enhancing relationship
func CreateFact ¶
func CreateFact(root string, lang core.LangType) (*FactStorage, error)
func (*FactStorage) GetFunctionsByFile ¶
func (fs *FactStorage) GetFunctionsByFile(fileName string) *extractor.FunctionFileResult
func (*FactStorage) GetSymbolsByFileAndLine ¶
func (fs *FactStorage) GetSymbolsByFileAndLine(fileName string, line int) []*extractor.Symbol
type FuncPos ¶
type Graph ¶ added in v0.10.1
type Graph struct { // k: file, v: function Cache map[string][]*Vertex // k: id, v: function IdCache map[string]*Vertex // contains filtered or unexported fields }
func CreateFuncGraph ¶
func CreateFuncGraph(fact *FactStorage, relationship *object.SourceContext) (*Graph, error)
func NewEmptyFuncGraph ¶
func NewEmptyFuncGraph() *Graph
func (*Graph) DirectReferenceIds ¶ added in v0.10.1
func (*Graph) DirectReferencedCount ¶ added in v0.10.1
DirectReferencedCount This function returns the number of direct references to a given function vertex in the function graph. It does so by counting the length of the slice of IDs of the function vertices that directly reference the given function vertex.
func (*Graph) DirectReferencedIds ¶ added in v0.10.1
func (*Graph) DrawG6Html ¶ added in v0.10.1
func (*Graph) FillWithOrange ¶ added in v0.10.1
func (*Graph) FillWithRed ¶ added in v0.10.1
func (*Graph) FillWithYellow ¶ added in v0.10.1
func (*Graph) FilterFunctions ¶ added in v0.10.1
func (*Graph) GetFunctionsByFile ¶ added in v0.10.1
func (*Graph) GetFunctionsByFileLines ¶ added in v0.10.1
func (*Graph) GlobalStat ¶ added in v0.10.2
func (fg *Graph) GlobalStat(points []*Vertex) *object.StatGlobal
func (*Graph) ListEntries ¶ added in v0.10.1
func (*Graph) ListFunctions ¶ added in v0.10.1
func (*Graph) RelationBetween ¶ added in v0.10.1
func (*Graph) RemoveNodeById ¶ added in v0.10.1
func (*Graph) TransitiveReferenceIds ¶ added in v0.10.1
func (*Graph) TransitiveReferencedIds ¶ added in v0.10.1
TransitiveReferencedIds This function takes a Graph and a Vertex as input and returns a slice of strings containing all the transitive referenced ids. It uses a map to store the referenced ids and a BFS algorithm to traverse the graph and add the referenced ids to the map. Finally, it returns the keys of the map as a slice of strings.
type Vertex ¶ added in v0.10.1
type Vertex struct { *object.Function *FuncPos // https://github.com/williamfzc/srctx/issues/41 Tags map[string]struct{} `json:"tags,omitempty"` }
func CreateFuncVertex ¶
func CreateFuncVertex(f *object.Function, fr *extractor.FunctionFileResult) *Vertex