Documentation
¶
Index ¶
- func GetBinaryOpNode() *math_node.BinaryOpNode
- func GetFunctionNode() *math_node.FunctionNode
- func GetNumberNode() *math_node.NumberNode
- func GetUnaryOpNode() *math_node.UnaryOpNode
- func GetVariableNode() *math_node.VariableNode
- func PutBinaryOpNode(node *math_node.BinaryOpNode)
- func PutFunctionNode(node *math_node.FunctionNode)
- func PutNumberNode(node *math_node.NumberNode)
- func PutToken(token *Token)
- func PutUnaryOpNode(node *math_node.UnaryOpNode)
- func PutVariableNode(node *math_node.VariableNode)
- func ResetExprCache()
- func ResetLexerCache()
- func ResetShardedCache()
- func SetExprCacheCapacity(capacity int)
- func SetLexerCacheCapacity(capacity int)
- type CompiledExpression
- func (ce *CompiledExpression) Evaluate(vars map[string]decimal.Decimal) (decimal.Decimal, error)
- func (ce *CompiledExpression) GetLastError() error
- func (ce *CompiledExpression) WithConfig(config *math_config.CalcConfig) *CompiledExpression
- func (ce *CompiledExpression) WithPrecision(precision int32) *CompiledExpression
- func (ce *CompiledExpression) WithPrecisionEachStep() *CompiledExpression
- func (ce *CompiledExpression) WithPrecisionFinalResult() *CompiledExpression
- func (ce *CompiledExpression) WithPrecisionMode(mode math_config.PrecisionMode) *CompiledExpression
- func (ce *CompiledExpression) WithTimeout(timeout time.Duration) *CompiledExpression
- type LRUCache
- type LRUCacheItem
- type Lexer
- type LexerCache
- type NodePool
- type Parser
- type ShardedLRUCache
- type Token
- type TokenPool
- type TokenType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetLexerCacheCapacity ¶
func SetLexerCacheCapacity(capacity int)
SetLexerCacheCapacity 设置词法分析器缓存容量
Types ¶
type CompiledExpression ¶
type CompiledExpression struct {
// contains filtered or unexported fields
}
CompiledExpression 预编译表达式结构体
func Compile ¶
func Compile(expression string, config *math_config.CalcConfig) (*CompiledExpression, error)
Compile 预编译表达式
func (*CompiledExpression) GetLastError ¶
func (ce *CompiledExpression) GetLastError() error
GetLastError 获取最后一次错误
func (*CompiledExpression) WithConfig ¶
func (ce *CompiledExpression) WithConfig(config *math_config.CalcConfig) *CompiledExpression
WithConfig 设置新的配置
func (*CompiledExpression) WithPrecision ¶
func (ce *CompiledExpression) WithPrecision(precision int32) *CompiledExpression
WithPrecision 设置精度
func (*CompiledExpression) WithPrecisionEachStep ¶
func (ce *CompiledExpression) WithPrecisionEachStep() *CompiledExpression
WithPrecisionEachStep 在每一步应用精度控制
func (*CompiledExpression) WithPrecisionFinalResult ¶
func (ce *CompiledExpression) WithPrecisionFinalResult() *CompiledExpression
WithPrecisionFinalResult 只在最终结果应用精度控制
func (*CompiledExpression) WithPrecisionMode ¶
func (ce *CompiledExpression) WithPrecisionMode(mode math_config.PrecisionMode) *CompiledExpression
WithPrecisionMode 设置精度模式
func (*CompiledExpression) WithTimeout ¶
func (ce *CompiledExpression) WithTimeout(timeout time.Duration) *CompiledExpression
WithTimeout 设置超时时间
type LRUCache ¶
type LRUCache struct {
// contains filtered or unexported fields
}
LRUCache LRU缓存结构体,用于存储已解析的表达式
type LRUCacheItem ¶
type LRUCacheItem struct {
// contains filtered or unexported fields
}
LRUCacheItem LRU缓存项
type LexerCache ¶
词法分析缓存
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Parser 解析器结构体
func NewParser ¶
func NewParser(vars map[string]decimal.Decimal, config *math_config.CalcConfig) *Parser
NewParser 创建新的解析器
type ShardedLRUCache ¶
type ShardedLRUCache struct {
// contains filtered or unexported fields
}
ShardedLRUCache 分片LRU缓存
func NewShardedLRUCache ¶
func NewShardedLRUCache(capacity int) *ShardedLRUCache
NewShardedLRUCache 创建新的分片LRU缓存
Click to show internal directories.
Click to hide internal directories.