camarero v0.4.1 Camarero.Plato behaviour View Source

This behaviour is high-level abstraction of the container begind handlers.

Aññ handlers are supposed to implement this behaviour. The simplest way is to use Camarero.Plato in the handler module; that will inject the default boilerlate using %{binary() => any()} map as a container behind.

Default implementation uses Camarero.Tapas as low-level container implementation.

Link to this section Summary

Callbacks

Returns the container itself, as is

Deletes the key-value pair for the key specified

Returns the value for the key specified

Sets the value for the key specified (intended to be used from the application)

Returns the route this module is supposed to be mounted to

Link to this section Callbacks

Returns the container itself, as is

Link to this callback

plato_delete(key) View Source
plato_delete(key :: binary() | atom()) :: :ok

Deletes the key-value pair for the key specified

Link to this callback

plato_get(key) View Source
plato_get(key :: binary() | atom()) ::
  {:ok, any()} | :error | {:error, {400 | 404 | non_neg_integer(), map()}}

Returns the value for the key specified

Link to this callback

plato_put(key, value) View Source
plato_put(key :: binary() | atom(), value :: any()) :: :ok

Sets the value for the key specified (intended to be used from the application)

Link to this callback

plato_route() View Source
plato_route() :: binary()

Returns the route this module is supposed to be mounted to