- Notifications
You must be signed in to change notification settings - Fork2
A general and configurable user matching library based on Go language / 一个基于Go语言实现的通用且可配置化的用户匹配库
License
WGrape/matching
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
A general and configurable user matching library based on Go language
How to find the target matching users by priority ?
Computing user and get the core data for matching.
- gender :male
- age :27
- gender=male;age=27
- gender=male
- age=27
- gender=female;age=27
- gender=female
- age=27
Get user Matched Property Combinations and fetch users fromuserMap by key in turn.
You can follow the steps below, or use theexample.
- app
version:the version number of applicationlanguage:the different agents
- strategy
rules:the different rules of matching
Expand config/config.yaml file
app:version:v1.0.0language:go1.16.10strategy:rules:# If it is a woman, first match the male, then the female -gender=0: -gender=1 -gender=0# If male, match female first, then male -gender=1: -gender=0 -gender=1# ... ...
Create a strategy object and callAutoCreateStrategy().
package mainimport ("matching/pkg/strategy")funcmain(){st:= strategy.UseStrategy{}err:=st.AutoCreateStrategy("config/config.yaml")iferr!=nil {fmt.Println(err.Error())return }}
You can getimplodePropertiesString,combinationList andmatchedCombinationList after callingComputeUser().
implodePropertiesString:implode the properties to stringcombinationList:get the combination list of propertiesmatchedCombinationList:get the matched combination list of properties
package mainimport ("matching/pkg/strategy")funcmain() {user:= strategy.User{UserId:"12345678",Score:0.0,Gender:0,Age:"80",City:"Yon",Status:1, }implodePropertiesString,combinationList,matchedCombinationList:=st.ComputeUser(user)}
Welcome to use and contribute to this project !
About
A general and configurable user matching library based on Go language / 一个基于Go语言实现的通用且可配置化的用户匹配库
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Uh oh!
There was an error while loading.Please reload this page.

