Obscura.Operator.Custom behaviour (obscura v0.1.0)

Copy Markdown View Source

Behaviour and guarded runtime for application-defined anonymizer operators.

Custom operators receive the source value, safe anonymizer context, and the configured options map. They must return {:ok, replacement} or {:ok, replacement, metadata} with a binary replacement and map metadata.

Summary

Types

Accepted custom operator callback return contract.

Sanitized anonymizer context supplied to a custom operator.

Application-defined options from the operator configuration.

Types

callback_result()

@type callback_result() ::
  {:ok, String.t()} | {:ok, String.t(), map()} | {:error, term()}

Accepted custom operator callback return contract.

context()

@type context() :: %{entity: atom()}

Sanitized anonymizer context supplied to a custom operator.

options()

@type options() :: map()

Application-defined options from the operator configuration.

Callbacks

apply(t, context, options)

@callback apply(String.t(), context(), options()) :: callback_result()