Behaviour for character persistence adapters.
Adapters provide storage capabilities for characters. The default Memory adapter uses ETS for simple, in-memory storage.
Implementing an Adapter
Implement the three callbacks: save/2, get/2, and delete/2.
Each receives a Definition struct and the character/id.
Summary
Callbacks
Delete a character by id. Returns :ok or {:error, reason}.
Get a character by id. Returns {:ok, character} or {:error, :not_found}.
Save a character. Returns {:ok, character} or {:error, reason}.
Callbacks
@callback delete(Jido.Character.Definition.t(), String.t()) :: :ok | {:error, term()}
Delete a character by id. Returns :ok or {:error, reason}.
@callback get(Jido.Character.Definition.t(), String.t()) :: {:ok, map()} | {:error, :not_found | term()}
Get a character by id. Returns {:ok, character} or {:error, :not_found}.
@callback save(Jido.Character.Definition.t(), map()) :: {:ok, map()} | {:error, term()}
Save a character. Returns {:ok, character} or {:error, reason}.