View Source Storex.Store behaviour (storex v0.4.0)

Summary

Callbacks

Link to this callback

init(session_id, params)

View Source
@callback init(session_id :: binary(), params :: any()) ::
  {:ok, state :: any()}
  | {:ok, state :: any(), key :: binary()}
  | {:error, reason :: binary()}

Called when store session starts.

Link to this callback

mutation(name, data, session_id, params, state)

View Source
@callback mutation(
  name :: binary(),
  data :: any(),
  session_id :: binary(),
  params :: any(),
  state :: any()
) ::
  {:reply, message :: any(), state :: any()}
  | {:noreply, state :: any()}
  | {:error, state :: any()}
Link to this callback

terminate(session_id, params, state)

View Source (optional)
@callback terminate(session_id :: binary(), params :: any(), state :: any()) :: any()

Called when store session ends.