XEts.update_counter

You're seeing just the function update_counter, go back to XEts module for more information.
Link to this function

update_counter(tab, key, update_op)

Specs

update_counter(t() | tab(), term(), term()) :: t() | [integer()] | integer()
update_counter(t() | tab(), term(), tuple() | meta()) ::
  t() | [integer()] | integer()

Equivalent to update_counter(tab, key, update_op, :shards_meta.get(tab)).

Examples

iex> %{tab: tab} = :test |> XEts.new() |> XEts.insert({10, 10, 4, "description"})
iex> XEts.update_counter(tab, 10, {3, 1})
5
iex> XEts.lookup(tab, 10)
[{10, 10, 5, "description"}]
Link to this function

update_counter(tab, key, update_op, default_or_meta)

Specs

update_counter(t() | tab(), term(), tuple(), meta()) ::
  t() | [integer()] | integer()

Equivalent to update_counter(tab, key, update_op, default_or_meta).

Examples

iex> %{tab: tab} = :test |> XEts.new()
iex> XEts.update_counter(tab, 10, {3, 1}, {10, 10, 4, "description"})
5
iex> XEts.lookup(tab, 10)
[{10, 10, 5, "description"}]
Link to this function

update_counter(tab, key, update_op, default, meta)

Equivalent to update_counter(tab, key, update_op, default, meta).

Examples

iex> %{tab: tab} = :test |> XEts.new() |> XEts.insert(x: 0, y: 1)
iex> meta = XEts.get_meta(tab)
iex> XEts.update_counter(tab, :x, {2, 3}, {:x, 0}, meta)
3
iex> XEts.update_counter(tab, :y, {2, 3}, {:y, 0}, meta)
4
iex> XEts.update_counter(tab, :z, {2, -1}, {:z, 5}, meta)
4
iex> XEts.to_list(tab) |> Enum.sort()
[x: 3, y: 4, z: 4]