crawlie v1.0.0 Crawlie.Stats.Counter

Summary

Functions

Increases the value of a counter in the map

Increases the value of a counter in the map

Functions

dec(map, key, amount \\ 1)
dec(map, term, integer | float) :: map

Increases the value of a counter in the map.

Example

iex> alias Crawlie.Stats.Counter
iex> stats = %{foo: 10, bar: 20.0}
iex> stats
...>   |> Counter.dec(:foo)
...>   |> Counter.dec(:bar, 2.0)
%{foo: 9, bar: 18.0}
inc(map, key, amount \\ 1)
inc(map, term, integer | float) :: map

Increases the value of a counter in the map.

Example

iex> alias Crawlie.Stats.Counter
iex> stats = %{foo: 10, bar: 20.0}
iex> stats
...>   |> Counter.inc(:foo)
...>   |> Counter.inc(:bar, 2.0)
%{foo: 11, bar: 22.0}