ecto_mnesia v0.9.1 EctoMnesia.Table

This module provides interface to perform CRUD and select operations on a Mnesia table.

Link to this section Summary

Functions

Get list of attributes that defined in Mnesia schema

Get count of records in a Mnesia table

Delete record from Mnesia table by key

Get the first key in the table, see mnesia:first

Read record from Mnesia table

Get Mnesia table name by binary or atom representation

Insert a record into Mnesia table

Get the last key in the table, see mnesia:last

Get the next key in the table starting from the given key, see mnesia:next

Returns auto-incremented integer ID for table in Mnesia

Get the previous key in the table starting from the given key, see mnesia:prev

Select all records that match MatchSpec. You can limit result by passing third optional argument

Run function fun inside a Mnesia transaction with specific context

Read record in Mnesia table by key

Link to this section Functions

Link to this function attributes(table)

Get list of attributes that defined in Mnesia schema.

Get count of records in a Mnesia table.

Link to this function delete(table, key, opts \\ [])

Delete record from Mnesia table by key.

Link to this function first(table)
first(atom()) :: any() | nil | no_return()

Get the first key in the table, see mnesia:first.

Link to this function get(table, key, opts \\ [])

Read record from Mnesia table.

Link to this function get_name(table)

Get Mnesia table name by binary or atom representation.

Link to this function insert(table, record, opts \\ [])

Insert a record into Mnesia table.

Link to this function last(table)
last(atom()) :: any() | nil | no_return()

Get the last key in the table, see mnesia:last.

Link to this function next(table, key)
next(atom(), any()) :: any() | nil | no_return()

Get the next key in the table starting from the given key, see mnesia:next.

Link to this function next_id(table, inc \\ 1)

Returns auto-incremented integer ID for table in Mnesia.

Sequence auto-generation is implemented as mnesia:dirty_update_counter.

Link to this function prev(table, key)
prev(atom(), any()) :: any() | nil | no_return()

Get the previous key in the table starting from the given key, see mnesia:prev.

Link to this function select(table, match_spec, limit \\ nil)

Select all records that match MatchSpec. You can limit result by passing third optional argument.

Link to this function transaction(fun, context \\ :transaction)

Run function fun inside a Mnesia transaction with specific context.

Make sure that you don’t run any code that can have side-effects inside a transactions, because it may be run dozens of times.

By default, context is :transaction.

Link to this function update(table, key, changes, opts \\ [])

Read record in Mnesia table by key.

You can partially update records by replacing values that you don’t want to touch with nil values. This function will automatically merge changes stored in Mnesia and update.