{"id":37205982,"url":"https://github.com/mrxrsd/gojacego","last_synced_at":"2026-01-14T23:43:32.425Z","repository":{"id":57620255,"uuid":"280042394","full_name":"mrxrsd/gojacego","owner":"mrxrsd","description":"gojacego is a calculation engine for Golang.","archived":false,"fork":false,"pushed_at":"2025-05-01T18:12:58.000Z","size":224,"stargazers_count":9,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-01T18:42:50.341Z","etag":null,"topics":["ast","calculation-engine","eval","evaluator","expression","expression-engine","expression-evaluator","expression-parser","formula","go","golang","interpreter","jace","math","mathematical-formula","mathematical-formula-evaluator","parser","token"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mrxrsd.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-07-16T03:24:32.000Z","updated_at":"2025-05-01T18:13:01.000Z","dependencies_parsed_at":"2022-09-19T09:41:49.754Z","dependency_job_id":null,"html_url":"https://github.com/mrxrsd/gojacego","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/mrxrsd/gojacego","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrxrsd%2Fgojacego","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrxrsd%2Fgojacego/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrxrsd%2Fgojacego/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrxrsd%2Fgojacego/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mrxrsd","download_url":"https://codeload.github.com/mrxrsd/gojacego/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrxrsd%2Fgojacego/sbom","scorecard":{"id":665002,"data":{"date":"2025-08-11","repo":{"name":"github.com/mrxrsd/gojacego","commit":"3425bcfa9f2c4895c271ac973d61a4071d6481cf"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.4,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/mrxrsd/gojacego/build.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/mrxrsd/gojacego/build.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/coverage.yml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/mrxrsd/gojacego/coverage.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/coverage.yml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/mrxrsd/gojacego/coverage.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/mrxrsd/gojacego/test.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/mrxrsd/gojacego/test.yml/master?enable=pin","Warn: goCommand not pinned by hash: .github/workflows/coverage.yml:22","Info:   0 out of   6 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 goCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/build.yml:1","Warn: no topLevel permission defined: .github/workflows/coverage.yml:1","Warn: no topLevel permission defined: .github/workflows/test.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-21T17:42:31.928Z","repository_id":57620255,"created_at":"2025-08-21T17:42:31.929Z","updated_at":"2025-08-21T17:42:31.929Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28439529,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T22:37:52.437Z","status":"ssl_error","status_checked_at":"2026-01-14T22:37:31.496Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ast","calculation-engine","eval","evaluator","expression","expression-engine","expression-evaluator","expression-parser","formula","go","golang","interpreter","jace","math","mathematical-formula","mathematical-formula-evaluator","parser","token"],"created_at":"2026-01-14T23:43:31.684Z","updated_at":"2026-01-14T23:43:32.405Z","avatar_url":"https://github.com/mrxrsd.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build](https://github.com/mrxrsd/gojacego/actions/workflows/build.yml/badge.svg?branch=master)](https://github.com/mrxrsd/gojacego/actions/workflows/build.yml)\n[![Test](https://github.com/mrxrsd/gojacego/actions/workflows/test.yml/badge.svg?branch=master)](https://github.com/mrxrsd/gojacego/actions/workflows/test.yml)\n[![GoReportCard](https://goreportcard.com/badge/github.com/mrxrsd/gojacego)](https://goreportcard.com/report/github.com/mrxrsd/gojacego)\n[![Coverage Status](https://coveralls.io/repos/github/mrxrsd/gojacego/badge.svg)](https://coveralls.io/github/mrxrsd/gojacego)\n[![Godoc](https://img.shields.io/static/v1?label=godoc\u0026message=reference\u0026color=ff69b4)](https://godoc.org/github.com/mrxrsd/gojacego)\n\n# goJACEgo\n\n\u003e 🚀 A lightning-fast mathematical expression engine for Go\n\ngoJACEgo is a high-performance calculation engine that brings the power of dynamic mathematical expressions to your Go applications. Built with pure Go, it delivers blazing-fast performance while maintaining simplicity and ease of use.\n\n'Jace' stands for \"Just Another Calculation Engine\". it is a port of Jace.NET\n\n## Why goJACEgo?\n\n✨ **Ultra-Fast Performance**: Consistently outperforms other expression evaluators in benchmarks\n🔧 **Simple Integration**: Just a few lines of code to get started\n🛡️ **Production-Ready**: Extensively tested with high code coverage\n🎯 **Dynamic Expressions**: Evaluate mathematical formulas on the fly\n⚡ **Variable Support**: Use dynamic variables in your expressions\n\n## What Can You Build With It?\n\n- 📊 Financial calculations and analytics\n- 🎮 Game scoring and mechanics\n- 📈 Real-time data processing\n- 🧮 Dynamic business rules\n- 🔬 Scientific computations\n\n## 🌐 Under the Hood\n\nBuilt on proven compiler design principles, goJACEgo's architecture ensures reliability and performance:\n\n### 🔢 Smart Tokenization\nConverts expressions into optimized tokens with low overhead\n\n### 🌳 Intelligent AST Creation\nBuilds a smart hierarchical tree that represents your mathematical formulas with precision\n\n### ⚡ Performance Optimization\nAutomatically optimizes the execution path for maximum speed\n\n![Architecture Overview](https://github.com/mrxrsd/gojacego/blob/master/.github/imgs/1.png?raw=true)\n\n[Learn more about the architecture](https://pieterderycke.wordpress.com/2012/11/04/jace-net-just-another-calculation-engine-for-net/)\n\n## 🔥 Quick Start\n\nGet up and running in seconds:\n\n### Simple Calculation\n\n```go\nengine, _ := gojacego.NewCalculationEngine()\n\nvars := map[string]interface{}{\n   \"price\": 29.99,\n   \"quantity\": 5\n}\n\ntotal, _ := engine.Calculate(\"price * quantity\", vars)\n// 149.95\n```\n\n### Advanced Usage\nBuild optimized formulas for repeated use:\n\n```go\nengine, _ := gojacego.NewCalculationEngine(\n    gojacego.WithOptimizeEnabled(true),    // 🚀 Speed optimization\n    gojacego.WithDefaultConstants(true),    // 📊 Built-in constants\n    gojacego.WithDefaultFunctions(true),    // ⚙️ Standard functions\n    gojacego.WithCaseSensitive(false)      // 🔧 Flexible syntax\n)\n\nformula := engine.Build(\"price * quantity * (1 - discount)\")\n\nresult := formula(map[string]interface{}{\n    \"price\": 99.99,\n    \"quantity\": 3,\n    \"discount\": 0.15\n})\n// 254.97\n```\n\n## ✨ Feature Highlights\n\n### 📊 Core Mathematical Operations\n\nThe following mathematical operations are supported:\n* Addition: +\n* Subtraction: -\n* Multiplication: *\n* Division: /\n* Modulo: %\n* Exponentiation: ^\n\n### Boolean Operations\n\nThe following boolean operations are supported:\n\n* Less than: \u003c\n* Less than or equal: \u003c=\n* More than: \u003e\n* More than or equal: \u003e=\n* Equal: ==\n* Not Equal: !=\n\nThe boolean operations map true to 1.0 and false to 0.0. All functions accepting a condition will consider 0.0 as false and any other value as true.\n\n```go\nresult, _ := engine.Calculate(\"5 \u003e 1\", nil)\n// 1.0\n```\n### Scientific Notation\n\n```go\nresult, _ := engine.Calculate(\"1E-3*5+2\", nil)\n// 2.005\n```\n\n### 🔑 Flexible Variable Support\n\nUse descriptive variable names that make sense for your business:\n```go\nvars := map[string]interface{}{\n\t\"$a\":  1,\n\t\"B\":   2,\n\t\"c_c\": 3,\n\t\"d1\":  4,\n\t\"VaR_vAr\": 10\n}\n\nresult, _ := engine.Calculate(\"$a + B + c_c + d1 + 10 + VaR_vAr\", vars)\n// 30.0\n```\n- Can contains letters ( a-z | A-Z ), underscore ( _ ), dolar sign ( $ ) or a number ( 0-9 ).\n- Cannot start with a number.\n- Cannot start with underscore.\n\n### 📍 Built-in Constants\n\n| Constant        |  Description | More Information |\n| ------------- | -------|----|\n| e |   Euler's number  | https://oeis.org/A001113 |\n| pi |   Pi| https://oeis.org/A000796 |\n\n```go\nresult, _ := engine.Calculate(\"2*pi\", nil)\n// 6.283185307179586\n```\n\n### 🔧 Comprehensive Function Library\n\nThe following mathematical functions are out of the box supported:\n\n| Function | Arguments       | Description         | More Information                                                                               |\n| -------- | --------------- | ------------------- | ---------------------------------------------------------------------------------------------- |\n| sin      | sin(x)          | Sine                | https://pkg.go.dev/math#Sin                                                                    |\n| cos      | cos(x)          | Cosine              | https://pkg.go.dev/math#Cos                                                                    |\n| asin     | asin(x)         | Arcsine             | [https://pkg.go.dev/math#Asin](https://pkg.go.dev/math#Asin)                                   |\n| acos     | acos(x)         | Arccosine           | https://pkg.go.dev/math#Acos                                                                   |\n| tan      | tan(x)          | Tangent             | https://pkg.go.dev/math#Tan                                                                    |\n| atan     | atan(x)         | Arctangent          | https://pkg.go.dev/math#Atan                                                                   |\n| log      | log(x)          | Logarithm           | https://pkg.go.dev/math#Log                                                                    |\n| sqrt     | sqrt(x)         | Square Root         | https://pkg.go.dev/math#Sqrt                                                                   |\n| trunc    | trunc(x)        | Truncate            | https://pkg.go.dev/math#Trunc                                                                  |\n| floor    | floor(x)        | Floor               | https://pkg.go.dev/math#Floor                                                                  |\n| ceil     | ceil(x)         | Ceil                | https://pkg.go.dev/math#Ceil                                                                   |\n| round    | round(x \\[,y\\]) | Round               | Rounds a number to a specified number of digits where 'x' is the number and 'y' is the digits. |\n| random   | random(x)       | Random              | Generate a random double value between 0.0 and 1.0 where 'x' is the seed.                      |\n| if       | if(a,b,c)       | Excel's IF Function | IF 'a' IS true THEN 'b' ELSE 'c'.                                                              |\n| max      | max(x1,…,xn)    | Maximum             | Return the maximum number of a series.                                                         |\n| min      | min(x1,…,xn)    | Minimum             | Return the minimum number of a series.                                                         |\n\n\n```go\n\n// Sin (ordinary function)\nvars := map[string]interface{}{\n   \"a\":2,\n}\nret, _ := engine.Calculate(\"sin(100)+a\", vars)\n// 1.4936343588902412\n\n// Round\nretRound, _ := engine.Calculate(\"round(1.234567,2)\", nil)\n// 1.23\n\n// If\nvars := map[string]interface{}{\n   \"a\":4,\n}\n\nifresult, _ := engine.Calculate(\"if(2+2==a, 10, 5)\", varsIf)\n// 10.0\n\n// MAX\nmax, _ := engine.Calculate(\"max(5,6,3,-4,5,3,7,8,13,100)\", nil)\n// 100.0\n\n\n\n```\n\n### Custom Functions \n\nCustom functions allow programmers to add additional functions besides the ones already supported (sin, cos, asin, …). Functions are required to have a unique name. The existing functions cannot be overwritten.\n\n```go\nengine.AddFunction(\"addTwo\", func(arguments ...interface{}) float64{\n\t\treturn arguments[0] + 2\n}, true)\n\nresult, _ := engine.Calculate(\"addTwo(2.0)\", nil)\n// 4.0\n\n```\n\n### Compile Time Constants\n\nVariables as defined in a formula can be replaced by a constant value at compile time. This feature is useful in case that a number of the parameters don't frequently change and that the formula needs to be executed many times. Thusfore it is better because constants could be optimizated on 'Optimization phase'.\n\n\n```go\n\nconsts := map[string]interface{}{\n   \"a\":1,\n}\nformula := engine.BuildWithConstants(\"a+b+c\", consts)\n// It's the same as 'engine.Build(\"1+b+c\")' but without dealing with string replace\n\nvars := map[string]interface{}{\n   \"b\":2,\n   \"c\":5\n}\n\nresult, := formula(vars)\n// 8.0\n```\n\n## Benchmark \n\nhttps://github.com/mrxrsd/golang-expression-evaluation-comparison\n\n### goJACEgo vs Others\n\n| Test                         |                     | \n|------------------------------|---------------------| \n| Benchmark_bexpr-8            |        2278 ns/op   | \n| Benchmark_celgo-8            |         127.0 ns/op | \n| Benchmark_evalfilter-8       |        1646 ns/op   | \n| Benchmark_expr-8             |         119.1 ns/op | \n| Benchmark_goja-8             |         306.9 ns/op | \n| Benchmark_gojacego-8         |         117.3 ns/op | \n| Benchmark_govaluate-8        |         259.9 ns/op | \n| Benchmark_gval-8             |         295.0 ns/op | \n| Benchmark_otto-8             |         951.2 ns/op | \n| Benchmark_starlark-8         |        5971 ns/op   | \n\n### goJACEgo vs Govaluate vs Expr vs Gval\n\n| Test                                   | Gojacego    | Govaluate   |  Expr        | Gval         |\n| -------------------------------------- | ----------- | ----------- |--------------|--------------|\n| BenchmarkEvaluationNumericLiteral      |  5.42 ns/op | 71.73 ns/op |  87.71 ns/op |   1.89 ns/op |\n| BenchmarkEvaluationLiteralModifiers    |  5.63 ns/op | 180.8 ns/op |  69.92 ns/op |   1.85 ns/op |\n| BenchmarkEvaluationParameter           | 11.25 ns/op | 72.47 ns/op |  69.75 ns/op |  147.1 ns/op |\n| BenchmarkEvaluationParameters          | 31.91 ns/op | 122.0 ns/op |  202.2 ns/op |  315.6 ns/op |\n| BenchmarkEvaluationParametersModifiers | 56.32 ns/op | 233.3 ns/op |  368.6 ns/op |  378.5 ns/op |\n| BenchmarkComplexPrecedenceMath         |  4.73 ns/op | 18.20 ns/op |  67.96 ns/op |   1.93 ns/op |\n| BenchmarkMath                          | 39.22 ns/op | 243.7 ns/op |  252.1 ns/op |  395.3 ns/op |\n\n\nDisclaimer: GoJACEgo has only mathematical and logical operators while others has more features.  \n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrxrsd%2Fgojacego","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrxrsd%2Fgojacego","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrxrsd%2Fgojacego/lists"}