Stati is a set of macros to do simple state manipulation, where state is a mixture of encapsulated maps and arrays.
Lets assume there is a variable state with the value
state=%{user: %{name: "foo",password: "bar"},something: %{else: "bar"}}and you want to change the password to "BAR" then you would normally do
${state|user: %{state.user|password: "BAR"}}which is kind of ugly and becomes even worse if you have more levels. With Stati it is done by
Stati.change(state.user.password="BAR")If available in Hex, the package can be installed as:
Add stati to your list of dependencies in
mix.exs:def deps do [{:stati, "~> 0.0.1"}] end
Ensure stati is started before your application:
def application do [applications: [:stati]] end