Raxol.Core.UserPreferences.Behaviour behaviour (Raxol v0.4.0)

View Source

Defines the behaviour for UserPreferences services.

Summary

Callbacks

Gets a user preference value by key path.

Retrieves the entire preferences map.

Forces an immediate save of the current preferences.

Sets a user preference value by key path.

Callbacks

get(key_or_path)

@callback get(key_or_path :: atom() | [atom()] | String.t()) :: any()

get(key_or_path, pid_or_name)

@callback get(
  key_or_path :: atom() | [atom()] | String.t(),
  pid_or_name :: GenServer.server() | atom() | nil
) :: any()

Gets a user preference value by key path.

get_all()

@callback get_all() :: map()

get_all(pid_or_name)

@callback get_all(pid_or_name :: GenServer.server() | atom() | nil) :: map()

Retrieves the entire preferences map.

save!()

@callback save!() :: :ok | {:error, any()}

save!(pid_or_name)

@callback save!(pid_or_name :: GenServer.server() | atom() | nil) :: :ok | {:error, any()}

Forces an immediate save of the current preferences.

set(key_or_path, value)

@callback set(
  key_or_path :: atom() | [atom()] | String.t(),
  value :: any()
) :: :ok

set(key_or_path, value, pid_or_name)

@callback set(
  key_or_path :: atom() | [atom()] | String.t(),
  value :: any(),
  pid_or_name :: GenServer.server() | atom() | nil
) :: :ok

Sets a user preference value by key path.