calc

package
v0.0.0-...-6752d0c Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Example (A1)
fmt.Println(Calc("1 + 1", store))
Output:

2
Example (A3)
store["cpu"] = 222.
store["a"] = 3.
fmt.Println(Calc("2 * a", store))
Output:

6
Example (B2)
fmt.Println(Calc("2 * 3", store))
Output:

6

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Calc

func Calc(input string, store map[string]interface{}) interface{}

Calc takes a string expression and returns the evaluated result.

func NewCalcVisitor

func NewCalcVisitor(store map[string]interface{}) *calcVisitor

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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