{"id":36751419,"url":"https://github.com/gitcfly/goexpr","last_synced_at":"2026-01-12T12:45:21.439Z","repository":{"id":57641679,"uuid":"382906148","full_name":"gitcfly/goexpr","owner":"gitcfly","description":"golang 表达式引擎，规则引擎，支持自定义函数，自定义中缀操作符，自定义前缀操作符，支持传参以及参数层级嵌套,支持数组，字符串，数字，变量等操作,Golang expression engine, rule engine, support custom functions, custom infix operators, custom prefix operators, support parameter passing and parameter hierarchical nesting, support arrays, strings, numbers, variables and other operations","archived":false,"fork":false,"pushed_at":"2021-07-07T14:09:02.000Z","size":41,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-06-20T11:57:09.108Z","etag":null,"topics":["engine","expression","rule"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gitcfly.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-07-04T17:05:48.000Z","updated_at":"2024-01-13T16:25:17.000Z","dependencies_parsed_at":"2022-09-26T16:40:21.744Z","dependency_job_id":null,"html_url":"https://github.com/gitcfly/goexpr","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/gitcfly/goexpr","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gitcfly%2Fgoexpr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gitcfly%2Fgoexpr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gitcfly%2Fgoexpr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gitcfly%2Fgoexpr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gitcfly","download_url":"https://codeload.github.com/gitcfly/goexpr/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gitcfly%2Fgoexpr/sbom","scorecard":{"id":427988,"data":{"date":"2025-08-11","repo":{"name":"github.com/gitcfly/goexpr","commit":"e2b81af77f30745e40c424452f407792e1a03662"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.6,"checks":[{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","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":"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":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"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":"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":"Code-Review","score":0,"reason":"Found 0/18 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":"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":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"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":"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":"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":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"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-19T02:40:16.385Z","repository_id":57641679,"created_at":"2025-08-19T02:40:16.385Z","updated_at":"2025-08-19T02:40:16.385Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28338983,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T12:22:26.515Z","status":"ssl_error","status_checked_at":"2026-01-12T12:22:10.856Z","response_time":98,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":["engine","expression","rule"],"created_at":"2026-01-12T12:45:20.802Z","updated_at":"2026-01-12T12:45:21.434Z","avatar_url":"https://github.com/gitcfly.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# goexpr\ngolang 表达式引擎，规则引擎，支持自定义函数，自定义中缀操作符，自定义前缀操作符，支持传参以及参数层级嵌套,支持数组，字符串，数字，变量等操作\n\nGolang expression engine, rule engine, support custom functions, custom infix operators, custom prefix operators, support parameter passing and parameter hierarchical nesting, support arrays, strings, numbers, variables and other operations\n```\nimport (\n\t\"fmt\"\n\t\"reflect\"\n\t\"testing\"\n)\n\nfunc Contain(a, b interface{}) interface{} {\n\tbStr := fmt.Sprint(b)\n\tarray := reflect.ValueOf(a)\n\tlength := array.Len()\n\tfor i := 0; i \u003c length; i++ {\n\t\taStr := fmt.Sprint(array.Index(i).Interface())\n\t\tif bStr == aStr {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}\n\nfunc TestEngine(t *testing.T) {\n\texprs := `-4+3\u003e(-9)\u0026\u00265\u003c4+5\u0026\u00263NotIN[1,2,4]\u0026\u0026ADD(1,2)\u003c4\u0026\u0026-(#-3-4)\u003c=30\u0026\u00264\u003e1\u0026\u0026[1,2,4] Contain 4 \u0026\u0026 ADD(1,2)!=1 \u0026\u0026 user.name=='kiteee' \u0026\u0026 user_count\u003e20`\n\t//exprs = `-------1`\n\t//exprs=`user.name=='kiteee' \u0026\u0026 user_count\u003e20`\n\t//exprs=`user_count\u003e20 \u0026\u0026 user_count\u003e20`\n\t//exprs=`#--3*-4-#2`\n\t//exprs=`-4-#2`\n\t//exprs = `3NotIN([1,2,3])\u0026\u0026ADD(1,2)\u003c4`\n\t//exprs = `[1,2,4] Contain 4 IN [true] NotIN [false]`\n\teg := NewEngine()\n\teg.AddFunc(\"ADD\", func(v ...interface{}) interface{} {\n\t\treturn floatVal(v[0]) + floatVal(v[1])\n\t})\n\teg.AddPrefix(\"#\", func(v interface{}) interface{} {\n\t\treturn floatVal(v) * floatVal(v)\n\t})\n\teg.AddInfix(\"Contain\", 30, func(v1, v2 interface{}) interface{} {\n\t\treturn Contain(v1, v2)\n\t})\n\tvar params = map[string]interface{}{\n\t\t\"user\": map[string]interface{}{\n\t\t\t\"name\": \"kiteee\",\n\t\t\t\"age\":  50,\n\t\t},\n\t\t\"user_count\": 30,\n\t}\n\t//eg.SetPriority(\"NotIN\", 30)\n\tresult := eg.Execute(exprs, params)\n\tfmt.Println(result)\n}\n\nfunc TestSpitExpr(t *testing.T) {\n\texprs := `('ssss','aaa',['aaa',bb],[aaa,game notIn values],funa bsna ( sa,ssdf), atype contains (90),type notIn [1,2,4],value \u003e= images ,-add(),[name,add()],-otEs(),[[-aaam,bb],bbb])`\n\texprs = `()`\n\tresult := SpitExpr(exprs)\n\tfor _, v := range result {\n\t\tfmt.Println(v)\n\t}\n}\n\nfunc TestGetArgs(t *testing.T) {\n\tvar mp = map[string]interface{}{\n\t\t\"user\": map[string]interface{}{\n\t\t\t\"name\": \"kiteee\",\n\t\t\t\"age\":  50,\n\t\t},\n\t}\n\tva := GetArg(\"user.name\", mp)\n\tfmt.Println(va)\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgitcfly%2Fgoexpr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgitcfly%2Fgoexpr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgitcfly%2Fgoexpr/lists"}