{"id":15567590,"url":"https://github.com/wgrape/matching","last_synced_at":"2026-02-23T03:41:50.130Z","repository":{"id":66350754,"uuid":"482578765","full_name":"WGrape/matching","owner":"WGrape","description":"A general and configurable user matching library based on Go language / 一个基于Go语言实现的通用且可配置化的用户匹配库","archived":false,"fork":false,"pushed_at":"2024-03-03T14:34:58.000Z","size":15,"stargazers_count":10,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-24T00:03:55.659Z","etag":null,"topics":["golang","golang-library","matching","strategy-game"],"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/WGrape.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-04-17T16:42:40.000Z","updated_at":"2024-03-07T10:10:44.000Z","dependencies_parsed_at":"2024-10-02T17:11:58.709Z","dependency_job_id":null,"html_url":"https://github.com/WGrape/matching","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WGrape%2Fmatching","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WGrape%2Fmatching/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WGrape%2Fmatching/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WGrape%2Fmatching/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/WGrape","download_url":"https://codeload.github.com/WGrape/matching/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250535098,"owners_count":21446508,"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":["golang","golang-library","matching","strategy-game"],"created_at":"2024-10-02T17:11:55.069Z","updated_at":"2026-02-23T03:41:45.088Z","avatar_url":"https://github.com/WGrape.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# matching\n\n[![MIT license](https://img.shields.io/badge/license-MIT-brightgreen.svg)](./LICENSE) \u003cimg src=\"https://img.shields.io/badge/language-go-blue.svg\"\u003e\n\nA general and configurable user matching library based on Go language\n\n## Overview\nHow to find the target matching users by priority ?\n\n\u003cimg width=\"600\" alt=\"image\" src=\"https://user-images.githubusercontent.com/35942268/166154495-415c04b6-c5af-4194-a250-93d26a757ee6.png\"\u003e\n\n### 1、Core Matching Logic\nComputing user and get the core data for matching.\n\n#### (1) User properties\n\n- gender ：male\n- age ：27\n\n#### (2) Property Combinations\n\n- gender=male;age=27\n- gender=male\n- age=27\n\n#### (3) Matched Property Combinations\n\n- gender=female;age=27\n- gender=female\n- age=27\n\n### 2、Store Users and Get Matched Users\n\n#### (1) Store Users\n\n\u003cimg width=\"600\" alt=\"image\" src=\"https://user-images.githubusercontent.com/35942268/166155670-7c6c9230-422a-461d-b965-3d1e2962c546.png\"\u003e\n\n#### (2) Get Matched Users\n\nGet user ``` Matched Property Combinations``` and fetch users from ```userMap``` by key in turn.\n\n## Usage\nYou can follow the steps below, or use the [example](./example/example.go).\n\n### 1、Configuration\n\n- app\n  - ```version``` ：the version number of application\n  - ```language``` ：the different agents\n- strategy\n  - ```rules``` ：the different rules of matching\n\n\u003cdetails\u003e\n\u003csummary\u003eExpand config/config.yaml file\u003c/summary\u003e\n\n```yaml\napp:\n  version: v1.0.0\n  language: go1.16.10\n\nstrategy:\n  rules:\n    # If it is a woman, first match the male, then the female\n    - gender=0:\n        - gender=1\n        - gender=0\n\n    # If male, match female first, then male\n    - gender=1:\n        - gender=0\n        - gender=1\n    # ... ...\n```\n\n\u003c/details\u003e\n\n### 2、Create strategy object\nCreate a strategy object and call ```AutoCreateStrategy()```.\n\n```go\npackage main\nimport (\n    \"matching/pkg/strategy\"\n)\n\nfunc main(){\n    st := strategy.UseStrategy{}\n    err := st.AutoCreateStrategy(\"config/config.yaml\")\n    if err != nil {\n        fmt.Println(err.Error())\n        return\n    }\t\n}\n```\n\n### 3、Compute user\nYou can get ```implodePropertiesString```，```combinationList``` and ```matchedCombinationList``` after calling ```ComputeUser()```.\n\n- ```implodePropertiesString``` ：implode the properties to string\n- ```combinationList``` ：get the combination list of properties\n- ```matchedCombinationList``` ：get the matched combination list of properties\n\n```go\npackage main\nimport (\n  \"matching/pkg/strategy\"\n)\n\nfunc main() {\n    user := strategy.User{\n      UserId: \"12345678\",\n      Score:  0.0,\n      Gender: 0,\n      Age:    \"80\",\n      City:   \"Yon\",\n      Status: 1,\n    }\n    implodePropertiesString, combinationList, matchedCombinationList := st.ComputeUser(user)\n}\n```\n\n## Contributing\nWelcome to use and contribute to this project !\n\n## License\n[LICENSE](./LICENSE)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwgrape%2Fmatching","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwgrape%2Fmatching","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwgrape%2Fmatching/lists"}