Bandera.Actor protocol (bandera v0.1.0)

Copy Markdown

Identifies an actor (e.g. a user) for actor and percentage_of_actors gates. The id must be a binary and stable for a given actor across a flag's lifetime.

Implementations ship for binaries, integers, and maps with an :id key; define the protocol for your own struct to control how it is identified.

Summary

Types

t()

All the types that implement this protocol.

Functions

Returns the stable string id for actor.

Types

t()

@type t() :: term()

All the types that implement this protocol.

Functions

id(actor)

@spec id(t()) :: String.t()

Returns the stable string id for actor.

Examples

iex> Bandera.Actor.id("user-1")
"user-1"

iex> Bandera.Actor.id(42)
"42"

iex> Bandera.Actor.id(%{id: 7})
"7"