Unleash / unleash-client-go

Unleash client SDK for Go
https://docs.getunleash.io
Apache License 2.0
138 stars 55 forks source link

Publicly expose the default Strategies for faster and more advanced Strategies. #90

Closed devaljain1998 closed 3 years ago

devaljain1998 commented 3 years ago

Hi Unleash team,

I request to propose to you a change for the notion of "open-source development". We have a use-case where we have to gradually rollout a feature to the users in some cities. As the strategies linked in frontend are executed in an OR fashion, we want to execute them in an AND fashion.

Example:

class CityStrategy:
    def is_enabled(params, context):
          return context.properties["cities"] in params["cities"]

and combining it with gradual rollout strategy:

class GradualRolloutCityStrategy:
    def is_enabled(params, context):
          return CityStrategy().is_enabled(params, context) and GradualRolloutStartegy.is_enabled(params, context)

Ability to use pre-defined strategy will take flexibility and possibilities with unleash-go to the next level. What do you think? Hoping to get this issue ingrained in the library.

NOTE: These are not actual code snippets. Added just for demonstration purposes.

devaljain1998 commented 3 years ago

@chriswk @FredrikOseberg @ivarconr Can you guys please take a note of this PR?

FredrikOseberg commented 3 years ago

@devaljain1998 Thanks for bringing this to our attention. I'm closing this because it is a duplicate issue of #42. I've added the tag "good first issue" and outlined the steps for completing the task in issue #42.

Hopefully someone can take a stab at this and send a pull request with the code, otherwise it will have to wait until I can spare the time to implement this.

Any further discussion on this can be added to issue #42.