Nebulex.Adapters.Mnesia.Table.Stream (nebulex_mnesia_adapter v2.6.5)
View SourceThis module provides streaming capabilities for Mnesia tables.
Summary
Functions
Streams entries from the specified Mnesia table.
Functions
@spec select( atom(), keyword() ) :: Enumerable.t()
Streams entries from the specified Mnesia table.
Parameters
table: The name of the Mnesia table (atom).opts: Options for streaming (keyword list).:return- Specifies what to return for each entry. Can be::key(default) - Returns only the keys.:value- Returns only the values.{:key, :value}- Returns both keys and values as tuples.
Returns
- A stream of entries from the table based on the specified return option.
Examples
iex> opts = [return: :key]
iex> Nebulex.Adapters.Mnesia.Table.Stream.select(:table, opts) |> Enum.to_list()
[:key1, :key2, :key3]
iex> opts = [return: :value]
iex> Nebulex.Adapters.Mnesia.Table.Stream.select(:table, opts) |> Enum.to_list()
[value1, value2, value3]
iex> opts = [return: {:key, :value}]
iex> Nebulex.Adapters.Mnesia.Table.Stream.select(:table, opts) |> Enum.to_list()
[{:key1, value1}, {:key2, value2}, {:key3, value3}]