-
Notifications
You must be signed in to change notification settings - Fork 0
Add Entitlement and EntitlementValueType #16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
0863857 to
3a0807e
Compare
3a0807e to
5cf2f0b
Compare
models.go
Outdated
| Traits []*Trait `json:"traits"` | ||
| Rules []*Rule `json:"rules"` | ||
| mu sync.Mutex `json:"-"` // mutex for thread safety | ||
| Entitlements []*FeatureEntitlement `json:"entitlements"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be tagged with omitempty?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bpapillon I think the original design was to have a map[string]*FeatureEntitlement here; I would strongly recommend we use a slice, though. It will be more flexible for us in the long run.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I went back and forth on this - in practice, we would probably create a map in memory regardless, because we're going to be checking entitlements by a flag key, so we'd set up the data structure for that to be O(1). But I agree that this is more flexible and that is the tradeoff.
wyt about that @cbrady ?
also, yes I would likely omitemty this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added omitempty
|
|
||
| type FeatureEntitlement struct { | ||
| FeatureID string `json:"feature_id"` | ||
| FeatureKey string `json:"feature_key"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this the flag key?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this is a term that Ben came up with for flag/feature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not a blocker for me but i feel like because we're going to be matching flags to this value we should call it flag key.

These will be populated after additional work on the backend