Skip to content

feat: add option for get gate with default value #32

Open
@liran2000

Description

@liran2000

Background

In continue of OpenFeature PR, it is a common practice to evaluate a boolean/gate with a default value:

BooleanEvaluation(ctx context.Context, flag string, defaultValue bool, evalCtx of.FlattenedContext)

Problem

BooleanEvaluation with default value true cannot fallback to true.
On scenarios such as get gate of non-existing gate, statsig returns false without indication of whether it was successful get gate or some error reason. Therefore, the evaluation will be evaluated to false in this case.

Suggested solution

  1. Similar to dynamic config function GetString(key string, fallback string), add:
GetGate(user User, gate string, fallback bool) FeatureGate
  1. Enrich FeatureGate with error and reason.

@kenny-statsig

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions