debug

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DebugInfo

type DebugInfo struct {
	Expression string            // 表达式
	Steps      []DebugStep       // 调试步骤
	Variables  map[string]string // 变量值
	Result     string            // 结果
	Error      error             // 错误
	// contains filtered or unexported fields
}

DebugInfo 调试信息结构体

func DebugCalculate

func DebugCalculate(expression string, vars map[string]decimal.Decimal, config *math_config.CalcConfig) (decimal.Decimal, *DebugInfo, error)

DebugCalculate 带调试信息的计算

func NewDebugInfo

func NewDebugInfo(expression string) *DebugInfo

NewDebugInfo 创建新的调试信息

func (*DebugInfo) AddStep

func (di *DebugInfo) AddStep(step DebugStep)

AddStep 添加调试步骤

func (*DebugInfo) SetError

func (di *DebugInfo) SetError(err error)

SetError 设置错误

func (*DebugInfo) SetResult

func (di *DebugInfo) SetResult(result decimal.Decimal)

SetResult 设置结果

func (*DebugInfo) SetVariables

func (di *DebugInfo) SetVariables(vars map[string]decimal.Decimal)

SetVariables 设置变量

func (*DebugInfo) String

func (di *DebugInfo) String() string

String 返回调试信息的字符串表示

type DebugStep

type DebugStep struct {
	NodeType    string      // 节点类型
	Operation   string      // 操作
	Operands    []string    // 操作数
	Result      string      // 结果
	Error       error       // 错误
	SubSteps    []DebugStep // 子步骤
	ElapsedTime int64       // 耗时(纳秒)
}

DebugStep 调试步骤结构体

Jump to

Keyboard shortcuts

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