dbdoc

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildSSA

func BuildSSA(ctx *Context, args []string) (*ssa.Program, []*packages.Package, error)

Types

type Call

type Call struct {
	FunctionID string
	Pos        token.Pos
}

type Config

type Config struct {
	WorkDir                      string
	BuildArgs                    []string
	IgnoreFuncs                  []string
	IgnoreFuncPrefixes           []string
	IgnoreMain, IgnoreInitialize bool
	DestinationFilePath          string
}

type Context

type Context struct {
	FileSet *token.FileSet
	WorkDir string
}

type Edge

type Edge struct {
	Label    string
	Node     *Node
	EdgeType EdgeType
	InLoop   bool
}

type EdgeType

type EdgeType uint8
const (
	EdgeTypeUnknown EdgeType = iota
	EdgeTypeInsert
	EdgeTypeUpdate
	EdgeTypeDelete
	EdgeTypeSelect
	EdgeTypeCall
)

type Function

type Function struct {
	ID      string
	Name    string
	Pos     token.Pos
	Queries []InLoop[Query]
	Calls   []InLoop[Call]
}

func BuildFuncs

func BuildFuncs(ctx *Context, pkgs []*packages.Package, ssaProgram *ssa.Program, loopRangeMap LoopRangeMap) ([]Function, error)

type InLoop

type InLoop[T any] struct {
	Value  T
	InLoop bool
}

type LoopRange

type LoopRange struct {
	Start token.Pos
	End   token.Pos
}

type LoopRangeMap

type LoopRangeMap map[string]LoopRanges

func BuildLoopRangeMap

func BuildLoopRangeMap(ctx *Context) (LoopRangeMap, error)

type LoopRanges

type LoopRanges []LoopRange

func (LoopRanges) Search

func (lr LoopRanges) Search(fset *token.FileSet, pos token.Pos) bool

type Node

type Node struct {
	ID       string
	Label    string
	NodeType NodeType
	Edges    []Edge
}

func BuildGraph

func BuildGraph(funcs []Function, ignoreFuncs, ignoreFuncPrefixes []string, ignoreMain, ignoreInitialize bool) []*Node

func Run

func Run(conf Config) ([]*Node, error)

type NodeType

type NodeType uint8
const (
	NodeTypeUnknown NodeType = iota
	NodeTypeTable
	NodeTypeFunction
)

type Query

type Query struct {
	QueryType QueryType
	Table     string
	Pos       token.Pos
	Raw       string
}

func AnalyzeSQL

func AnalyzeSQL(ctx *Context, sql stringLiteral) []Query

func (Query) String added in v1.2.1

func (q Query) String() string

type QueryType

type QueryType uint8
const (
	QueryTypeSelect QueryType = iota + 1
	QueryTypeInsert
	QueryTypeUpdate
	QueryTypeDelete
)

func (QueryType) String

func (qt QueryType) String() string

Jump to

Keyboard shortcuts

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