{"id":13526349,"url":"https://github.com/expr-lang/expr","last_synced_at":"2025-05-13T11:08:22.870Z","repository":{"id":199828192,"uuid":"140958903","full_name":"expr-lang/expr","owner":"expr-lang","description":"Expression language and expression evaluation for Go","archived":false,"fork":false,"pushed_at":"2025-05-12T16:32:48.000Z","size":11577,"stargazers_count":6847,"open_issues_count":39,"forks_count":437,"subscribers_count":68,"default_branch":"master","last_synced_at":"2025-05-13T11:08:06.621Z","etag":null,"topics":["bytecode","configuration-language","engine","evaluator","expr","expression","expression-evaluator","expression-language","go","golang","rule-engine"],"latest_commit_sha":null,"homepage":"https://expr-lang.org","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/expr-lang.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"antonmedv"}},"created_at":"2018-07-14T15:57:34.000Z","updated_at":"2025-05-13T03:00:07.000Z","dependencies_parsed_at":"2024-02-08T12:30:06.893Z","dependency_job_id":"952288a5-c07c-4ef4-9674-3044ea1d0599","html_url":"https://github.com/expr-lang/expr","commit_stats":{"total_commits":754,"total_committers":59,"mean_commits":"12.779661016949152","dds":"0.10212201591511938","last_synced_commit":"f631fd2c26c46dd10b9e3d494dfa703a4a6d7b1f"},"previous_names":["antonmedv/expr"],"tags_count":96,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/expr-lang%2Fexpr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/expr-lang%2Fexpr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/expr-lang%2Fexpr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/expr-lang%2Fexpr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/expr-lang","download_url":"https://codeload.github.com/expr-lang/expr/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253929367,"owners_count":21985802,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["bytecode","configuration-language","engine","evaluator","expr","expression","expression-evaluator","expression-language","go","golang","rule-engine"],"created_at":"2024-08-01T06:01:28.358Z","updated_at":"2025-05-13T11:08:22.843Z","avatar_url":"https://github.com/expr-lang.png","language":"Go","readme":"\u003ch1\u003e\u003ca href=\"https://expr-lang.org\"\u003e\u003cimg src=\"https://expr-lang.org/img/logo.png\" alt=\"Zx logo\" height=\"48\"align=\"right\"\u003e\u003c/a\u003e Expr\u003c/h1\u003e\n\n\u003e [!IMPORTANT]\n\u003e The repository [github.com/antonmedv/expr](https://github.com/antonmedv/expr) moved to [github.com/**expr-lang**/expr](https://github.com/expr-lang/expr).\n\n[![test](https://github.com/expr-lang/expr/actions/workflows/test.yml/badge.svg)](https://github.com/expr-lang/expr/actions/workflows/test.yml) \n[![Go Report Card](https://goreportcard.com/badge/github.com/expr-lang/expr)](https://goreportcard.com/report/github.com/expr-lang/expr) \n[![Fuzzing Status](https://oss-fuzz-build-logs.storage.googleapis.com/badges/expr.svg)](https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened\u0026can=1\u0026q=proj:expr)\n[![GoDoc](https://godoc.org/github.com/expr-lang/expr?status.svg)](https://godoc.org/github.com/expr-lang/expr)\n\n**Expr** is a Go-centric expression language designed to deliver dynamic configurations with unparalleled accuracy, safety, and speed. \n**Expr** combines simple [syntax](https://expr-lang.org/docs/language-definition) with powerful features for ease of use:\n\n```js\n// Allow only admins and moderators to moderate comments.\nuser.Group in [\"admin\", \"moderator\"] || user.Id == comment.UserId\n```\n\n```js\n// Determine whether the request is in the permitted time window.\nrequest.Time - resource.Age \u003c duration(\"24h\")\n```\n\n```js\n// Ensure all tweets are less than 240 characters.\nall(tweets, len(.Content) \u003c= 240)\n```\n\n## Features\n\n**Expr** is a safe, fast, and intuitive expression evaluator optimized for the Go language. \nHere are its standout features:\n\n### Safety and Isolation\n* **Memory-Safe**: Expr is designed with a focus on safety, ensuring that programs do not access unrelated memory or introduce memory vulnerabilities.\n* **Side-Effect-Free**: Expressions evaluated in Expr only compute outputs from their inputs, ensuring no side-effects that can change state or produce unintended results.\n* **Always Terminating**: Expr is designed to prevent infinite loops, ensuring that every program will conclude in a reasonable amount of time.\n\n### Go Integration\n* **Seamless with Go**: Integrate Expr into your Go projects without the need to redefine types.\n\n### Static Typing\n* Ensures type correctness and prevents runtime type errors.\n  ```go\n  out, err := expr.Compile(`name + age`)\n  // err: invalid operation + (mismatched types string and int)\n  // | name + age\n  // | .....^\n  ```\n\n### User-Friendly\n* Provides user-friendly error messages to assist with debugging and development.\n\n### Flexibility and Utility\n* **Rich Operators**: Offers a reasonable set of basic operators for a variety of applications.\n* **Built-in Functions**: Functions like `all`, `none`, `any`, `one`, `filter`, and `map` are provided out-of-the-box.\n\n### Performance\n* **Optimized for Speed**: Expr stands out in its performance, utilizing an optimizing compiler and a bytecode virtual machine. Check out these [benchmarks](https://github.com/antonmedv/golang-expression-evaluation-comparison#readme) for more details.\n\n## Install\n\n```\ngo get github.com/expr-lang/expr\n```\n\n## Documentation\n\n* See [Getting Started](https://expr-lang.org/docs/Getting-Started) page for developer documentation.\n* See [Language Definition](https://expr-lang.org/docs/language-definition) page to learn the syntax.\n\n## Examples\n\n[Play Online](https://go.dev/play/p/XCoNXEjm3TS)\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"github.com/expr-lang/expr\"\n)\n\nfunc main() {\n\tenv := map[string]interface{}{\n\t\t\"greet\":   \"Hello, %v!\",\n\t\t\"names\":   []string{\"world\", \"you\"},\n\t\t\"sprintf\": fmt.Sprintf,\n\t}\n\n\tcode := `sprintf(greet, names[0])`\n\n\tprogram, err := expr.Compile(code, expr.Env(env))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\toutput, err := expr.Run(program, env)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfmt.Println(output)\n}\n```\n\n[Play Online](https://go.dev/play/p/tz-ZneBfSuw)\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"github.com/expr-lang/expr\"\n)\n\ntype Tweet struct {\n\tLen int\n}\n\ntype Env struct {\n\tTweets []Tweet\n}\n\nfunc main() {\n\tcode := `all(Tweets, {.Len \u003c= 240})`\n\n\tprogram, err := expr.Compile(code, expr.Env(Env{}))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tenv := Env{\n\t\tTweets: []Tweet{{42}, {98}, {69}},\n\t}\n\toutput, err := expr.Run(program, env)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfmt.Println(output)\n}\n```\n\n## Who uses Expr?\n\n* [Google](https://google.com) uses Expr as one of its expression languages on the [Google Cloud Platform](https://cloud.google.com).\n* [Uber](https://uber.com) uses Expr to allow customization of its Uber Eats marketplace.\n* [GoDaddy](https://godaddy.com) employs Expr for the customization of its GoDaddy Pro product.\n* [ByteDance](https://bytedance.com) incorporates Expr into its internal business rule engine.\n* [Aviasales](https://aviasales.ru) utilizes Expr as a business rule engine for its flight search engine.\n* [Wish.com](https://www.wish.com) employs Expr in its decision-making rule engine for the Wish Assistant.\n* [Argo](https://argoproj.github.io) integrates Expr into Argo Rollouts and Argo Workflows for Kubernetes.\n* [OpenTelemetry](https://opentelemetry.io) integrates Expr into the OpenTelemetry Collector.\n* [Philips Labs](https://github.com/philips-labs/tabia) employs Expr in Tabia, a tool designed to collect insights on their code bases.\n* [CrowdSec](https://crowdsec.net) incorporates Expr into its security automation tool.\n* [CoreDNS](https://coredns.io) uses Expr in CoreDNS, which is a DNS server.\n* [qiniu](https://www.qiniu.com) implements Expr in its trade systems.\n* [Junglee Games](https://www.jungleegames.com/) uses Expr for its in-house marketing retention tool, Project Audience.\n* [Faceit](https://www.faceit.com) uses Expr to enhance customization of its eSports matchmaking algorithm.\n* [Chaos Mesh](https://chaos-mesh.org) incorporates Expr into Chaos Mesh, a cloud-native Chaos Engineering platform.\n* [Visually.io](https://visually.io) employs Expr as a business rule engine for its personalization targeting algorithm.\n* [Akvorado](https://github.com/akvorado/akvorado) utilizes Expr to classify exporters and interfaces in network flows.\n* [keda.sh](https://keda.sh) uses Expr to allow customization of its Kubernetes-based event-driven autoscaling.\n* [Span Digital](https://spandigital.com/) uses Expr in its Knowledge Management products.\n* [Xiaohongshu](https://www.xiaohongshu.com/) combining yaml with Expr for dynamically policies delivery.\n* [Melrōse](https://melrōse.org) uses Expr to implement its music programming language.\n* [Tork](https://www.tork.run/) integrates Expr into its workflow execution.\n* [Critical Moments](https://criticalmoments.io) uses Expr for its mobile realtime conditional targeting system.\n* [WoodpeckerCI](https://woodpecker-ci.org) uses Expr for [filtering workflows/steps](https://woodpecker-ci.org/docs/usage/workflow-syntax#evaluate).\n* [FastSchema](https://github.com/fastschema/fastschema) - A BaaS leveraging Expr for its customizable and dynamic Access Control system.\n* [WunderGraph Cosmo](https://github.com/wundergraph/cosmo) - GraphQL Federeration Router uses Expr to customize Middleware behaviour\n* [SOLO](https://solo.one) uses Expr interally to allow dynamic code execution with custom defined functions.\n\n[Add your company too](https://github.com/expr-lang/expr/edit/master/README.md)\n\n## License\n\n[MIT](https://github.com/expr-lang/expr/blob/master/LICENSE)\n\n\u003cp align=\"center\"\u003e\u003cimg src=\"https://expr-lang.org/img/gopher-small.png\" width=\"150\" /\u003e\u003c/p\u003e\n","funding_links":["https://github.com/sponsors/antonmedv"],"categories":["Go","Go 程序设计","golang","Embeddable Scripting Languages","\u003ca name=\"Go\"\u003e\u003c/a\u003eGo"],"sub_categories":["网络服务_其他","Search and Analytic Databases"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexpr-lang%2Fexpr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fexpr-lang%2Fexpr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexpr-lang%2Fexpr/lists"}