View Source cfclient_evaluator (cfclient v1.2.0)

Functions to evaluate flag rules.

Link to this section Summary

Link to this section Types

-type config() :: map().
-type flag() ::
    #{createdAt => integer(),
      defaultServe := cfapi_serve:cfapi_serve(),
      environment := binary(),
      excluded => list(),
      feature := binary(),
      identifier => binary(),
      included => list(),
      kind := binary(),
      modifiedAt => integer(),
      name => binary(),
      offVariation := binary(),
      prerequisites => list(),
      project := binary(),
      rules => [map()],
      state := binary() | map(),
      tags => list(),
      variationToTargetMap => [variation_map()] | null,
      variations := list(),
      version => integer()}.
-type rule() ::
    #{priority := non_neg_integer(),
      clauses := [rule_clause()],
      serve => rule_serve(),
      op => binary(),
      values => [binary()],
      excluded => [map()] | null,
      included => [map()] | null}.
-type rule_clause() :: #{op := binary(), values := [binary()]}.
-type rule_serve() :: #{variation := binary(), distribution => boolean()}.
-type segment() :: cfapi_segment:cfapi_segment().
-type target() :: cfclient:target().
-type variation_map() ::
    #{variation := binary(), targets := [cfapi_variation_map:cfapi_variation_map()]}.

Link to this section Functions

Link to this function

bool_variation(FlagId, Target, Config)

View Source
-spec bool_variation(binary(), target(), config()) ->
                  {ok, Id :: binary(), Value :: boolean()} | {error, Reason :: atom()}.
Link to this function

custom_attribute_to_binary(Value)

View Source
-spec custom_attribute_to_binary(binary() | atom() | number() | string()) -> binary() | [binary()].
Link to this function

is_rule_included_or_excluded(Clauses, Target)

View Source
-spec is_rule_included_or_excluded([rule_clause()], target()) -> included | excluded | false.
Link to this function

json_variation(FlagId, Target, Config)

View Source
-spec json_variation(binary(), target(), config()) ->
                  {ok, Id :: binary(), Value :: map()} | {error, Reason :: atom()}.
Link to this function

number_variation(FlagId, Target, Config)

View Source
-spec number_variation(binary(), target(), config()) ->
                    {ok, Id :: binary(), Value :: number()} | {error, Reason :: atom()}.
Link to this function

string_variation(FlagId, Target, Config)

View Source
-spec string_variation(binary(), target(), config()) ->
                    {ok, Id :: binary(), Value :: binary()} | {error, Reason :: atom()}.