hesabu

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2018 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Functions

func Functions() map[string]govaluate.ExpressionFunction

Functions return function registry

Types

type CustomError

type CustomError struct {
	EvalError EvalError
}

returned as err

func (*CustomError) Error

func (e *CustomError) Error() string

type EvalError

type EvalError struct {
	Source     string `json:"source"`
	Expression string `json:"expression"`
	Message    string `json:"message"`
}

Eval or parsing errors

func (*EvalError) Error

func (e *EvalError) Error() string

type ParsedEquations

type ParsedEquations struct {
	RawEquations map[string]string
	Equations    map[string]govaluate.EvaluableExpression
	Dependencies map[string][]string
	Errors       []EvalError
}

ParsedEquations raw equation, EvaluableExpression and dependencies

func Parse

func Parse(rawEquations map[string]string, functions map[string]govaluate.ExpressionFunction) ParsedEquations

Parse string equation in a EvaluableExpressions and their dependencies

func (ParsedEquations) Solve

func (parsedEquations ParsedEquations) Solve() (map[string]interface{}, error)

Solve the equation in correct order and return map of values

Jump to

Keyboard shortcuts

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