https://github.com/dakimura/partition
https://github.com/dakimura/partition
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/dakimura/partition
- Owner: dakimura
- License: mit
- Created: 2020-07-27T06:08:35.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-07-27T06:10:07.000Z (almost 5 years ago)
- Last Synced: 2023-03-11T04:03:30.229Z (about 2 years ago)
- Language: Go
- Size: 2.93 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Partition
parition/ab package contains an implementation to partition your users to some groups for A/B testing.
## Installation
~~~~
go get "github.com/dakimura/partition/ab"
~~~~Or you can manually git clone the repository to
`$(go env GOPATH)/src/github.com/dakimura/partition`.## Usage
```
package exampleimport "github.com/dakimura/partition/ab"
func example() {
abTest, _ := ab.NewTest(
[]ab.Group{
{ID: "default", TargetPercentage: 50,},
{ID: "GroupA", TargetPercentage: 25,},
{ID: "GroupB", TargetPercentage: 25,},
},
)userID := "Kimura Takuya"
group := abTest.GetGroup(userID)
switch group {
case "GroupA":
print("behavior 1")
case "GroupB":
print("behavior 2")
default:
print("default behavior")
}
}
```