guaxinim v0.1.2 Guaxinim.Database.ModuleDefinition

Link to this section Summary

Functions

Require the needed modules to use the table effectively

Add a copy of the table on the given node with the given mode

Add the index in the table for the given attribute

Read a record based on a slot, see mnesia:dirty_slot

The in order keyword list of attributes passed when the table was defined

Check if the table is a bag

Clear the content of the table

Change the copying mode of the table on the given node, see mnesia:change_table_copy_type

Get the number of records in the table

Create the table with the given copying mode and inherent definition

Return the database the table belongs to

Delete the record or the given key from the table, see mnesia:delete and mnesia:delete_object

Delete the record or the given key from the table with the given lock, see mnesia:delete and mnesia:delete_object

Delete the record or the given key from the table, see mnesia:dirty_delete and mnesia:dirty_delete_object

Delete a copy of the table from the given node

Delete the index in the table for the given attribute

Destroy the table

Destroy the table, raising if an error occurs

Return the first key or record in the table, see mnesia:first

Return the first key or record in the table, see mnesia:dirty_first

Fold the whole table from the left, see mnesia:foldl

Fold the whole table from the right, see mnesia:foldr

Force load the table

Get the name of the id key

Get information about the table, see mnesia:table_info

Return the key of the record

Return all the keys in the table, see mnesia:all_keys

Return all keys in the table, see mnesia:dirty_all_keys

Return the last key or record in the table, see mnesia:last

Return the last key or record in the table, see mnesia:dirty_last

Lock the table with the given lock

Change the table majority

Set master nodes for the table, see mnesia:set_master_nodes

Select records in the table using simple don’t care values, see mnesia:match_object

Select records in the table using simple don’t care values, see mnesia:dirty_match_object

Check if the key is present in the table

Change the access of the table, see mnesia:change_table_access_mode

Move a copy of the table from the given node to another given node

Return the next key or record in the table, see mnesia:next

Return the next key or record in the table, see mnesia:dirty_next

The options passed when the table was defined

Check if the table is an ordered set

Return the previous key or record in the table, see mnesia:prev

Return the previous key or record in the table, see mnesia:dirty_prev

Change the table loading priority

Return properties of the table

Read a record from the table with the given lock, see mnesia:read

Read a record from the table, see mnesia:dirty_read

Read records from the table based on a secondary index given as position, see mnesia:index_read

Read records from the table based on a secondary index given as position, see mnesia:dirty_index_read

Select records in the table using a match_spec, see mnesia:select

Select records in the given table using a match_spec passing a limit or a lock kind, see mnesia:select

Select records in the given table using a match_spec passing a limit and a lock kind, see mnesia:select

Select records in the table using a match_spec, see mnesia:dirty_select

Check if the table is a set

Return an iterator to use with Enum functions

Return an iterator to use with the Enum functions using dirty operations to retrieve information

Return the type of the table

Wait for the table optionally with a timeout

Select records in the table using an Exquisite query, see Exquisite.match/2 and mnesia:select

Select records in the table using an Exquisite query, see Exquisite.match/2 and mnesia:dirty_select

Write the record to the table, see mnesia:write

Write the record to the table, see mnesia:dirty_write

Link to this section Types

Link to this type autoincrement()
autoincrement() :: non_neg_integer()

Link to this section Functions

Link to this macro __using__(opts) (macro)

Require the needed modules to use the table effectively.

Link to this function add_copy(node, type \\ :disk)
add_copy(node(), Amnesia.Table.cv()) :: Amnesia.Table.o()

Add a copy of the table on the given node with the given mode.

Link to this function add_index(attribute)
add_index(atom()) :: Amnesia.Table.o()

Add the index in the table for the given attribute.

Link to this function at!(position)
at!(integer()) :: t() | nil | no_return()

Read a record based on a slot, see mnesia:dirty_slot.

Link to this function attributes()
attributes() :: Keyword.t()

The in order keyword list of attributes passed when the table was defined.

Link to this function bag?()
bag?() :: boolean()

Check if the table is a bag.

Clear the content of the table.

Link to this function copying(node, to)
copying(node(), Amnesia.Table.cv()) :: Amnesia.Table.o()

Change the copying mode of the table on the given node, see mnesia:change_table_copy_type.

Modes

  • :disk sets :disc_copies mode
  • :disk! sets :disc_only_copies mode
  • :memory sets :ram_copies mode
Link to this function count()
count() :: non_neg_integer()

Get the number of records in the table.

Link to this function create(copying \\ [])
create(Amnesia.Table.c()) :: Amnesia.o()

Create the table with the given copying mode and inherent definition.

Link to this function create!(copying \\ [])
create!(Amnesia.Table.c()) :: :ok | no_return()
Link to this function database()
database() :: module()

Return the database the table belongs to.

Link to this function delete(self)
delete(any() | t()) :: :ok | no_return()

Delete the record or the given key from the table, see mnesia:delete and mnesia:delete_object.

Link to this function delete(self, lock)
delete(atom() | any(), t() | atom()) :: :ok | no_return()

Delete the record or the given key from the table with the given lock, see mnesia:delete and mnesia:delete_object.

Locks

  • :write sets a :write lock
  • :write! sets a :sticky_write lock
Link to this function delete!(self)
delete!(t() | any()) :: :ok | no_return()

Delete the record or the given key from the table, see mnesia:dirty_delete and mnesia:dirty_delete_object.

Link to this function delete_copy(node)
delete_copy(node()) :: Amnesia.Table.o()

Delete a copy of the table from the given node.

Link to this function delete_index(attribute)
delete_index(atom()) :: Amnesia.Table.o()

Delete the index in the table for the given attribute.

Link to this function destroy()
destroy() :: Amnesia.Table.o()

Destroy the table.

Link to this function destroy!()
destroy!() :: :ok | no_return()

Destroy the table, raising if an error occurs.

Link to this function first(key \\ false, lock \\ :read)
first(boolean(), atom()) :: any() | t() | nil | no_return()

Return the first key or record in the table, see mnesia:first.

By default it returns the record, if you want only the key pass true as first parameter.

If the table is a bag, it will return a list of records.

Link to this function first!(key \\ false)
first!(boolean()) :: any() | t() | nil | no_return()

Return the first key or record in the table, see mnesia:dirty_first.

By default it returns the record, if you want only the key pass true as first parameter.

If the table is a bag, it will return a list of records.

Link to this function foldl(acc, fun)
foldl(any(), (t(), any() -> any())) :: any() | no_return()

Fold the whole table from the left, see mnesia:foldl.

Link to this function foldr(acc, fun)
foldr(any(), (t(), any() -> any())) :: any() | no_return()

Fold the whole table from the right, see mnesia:foldr.

Link to this function force()
force() :: :yes | {:error, any()}

Force load the table.

Link to this function hook_read(_, _)
Link to this function hook_read!(_, _)
Link to this function id()
id() :: atom()

Get the name of the id key.

Link to this function info(key)
info(atom()) :: any()

Get information about the table, see mnesia:table_info.

Link to this function key(module_definition)
key(t()) :: any()

Return the key of the record.

Link to this function keys()
keys() :: list() | no_return()

Return all the keys in the table, see mnesia:all_keys.

Link to this function keys!()
keys!() :: list() | no_return()

Return all keys in the table, see mnesia:dirty_all_keys.

Link to this function last(key \\ false, lock \\ :read)
last(boolean(), atom()) :: any() | t() | nil | no_return()

Return the last key or record in the table, see mnesia:last.

By default it returns the record, if you want only the key pass true as first parameter.

If the table is a bag, it will return a list of records.

Link to this function last!(key \\ false)
last!(boolean()) :: any() | t() | nil | no_return()

Return the last key or record in the table, see mnesia:dirty_last.

By default it returns the record, if you want only the key pass true as first parameter.

If the table is a bag, it will return a list of records.

Link to this function lock(mode)
lock(:write | :write! | :read) :: [node()] | :ok | no_return()

Lock the table with the given lock.

Locks

  • :write sets a :write lock
  • :write! sets a :sticky_write lock
  • :read sets a :read lock
Link to this function majority(value)
majority(boolean()) :: Amnesia.Table.o()

Change the table majority.

Link to this function master_nodes(nodes)
master_nodes([node()]) :: :ok | {:error, any()}

Set master nodes for the table, see mnesia:set_master_nodes.

Link to this function match(lock \\ :read, pattern)
match(:read | :write, any()) :: [t()] | nil | no_return()

Select records in the table using simple don’t care values, see mnesia:match_object.

Link to this function match!(pattern)
match!(any()) :: [t()] | nil | no_return()

Select records in the table using simple don’t care values, see mnesia:dirty_match_object.

Link to this function member?(key)
member?(any()) :: boolean()

Check if the key is present in the table.

Link to this function mode(value)
mode(:both | :read!) :: Amnesia.Table.o()

Change the access of the table, see mnesia:change_table_access_mode.

Modes

  • :both sets read and write mode, it’s the default.
  • :read! sets read-only mode.
Link to this function move_copy(from, to)
move_copy(node(), node()) :: Amnesia.Table.o()

Move a copy of the table from the given node to another given node.

Link to this function next(self)
next(any() | t()) :: any() | t() | nil | no_return()

Return the next key or record in the table, see mnesia:next.

If you’re calling this function from an instance of the table (a record in it), it will get you the next record, if you’re calling it directly on the module it will treat the argument as key to start from and return you the next key.

Link to this function next!(self)
next!(any() | t()) :: any() | t() | nil | no_return()

Return the next key or record in the table, see mnesia:dirty_next.

If you’re calling this function from an instance of the table (a record in it), it will get you the next record, if you’re calling it directly on the module it will treat the argument as key to start from and return you the next key.

Link to this function options()
options() :: Keyword.t()

The options passed when the table was defined.

Link to this function ordered_set?()
ordered_set?() :: boolean()

Check if the table is an ordered set.

Link to this function prev(self)
prev(any() | t()) :: any() | t() | nil | no_return()

Return the previous key or record in the table, see mnesia:prev.

If you’re calling this function from an instance of the table (a record in it), it will get you the previous record, if you’re calling it directly on the module it will treat the argument as key to start from and return you the previous key.

Link to this function prev!(self)
prev!(any() | t()) :: any() | t() | nil | no_return()

Return the previous key or record in the table, see mnesia:dirty_prev.

If you’re calling this function from an instance of the table (a record in it), it will get you the previous record, if you’re calling it directly on the module it will treat the argument as key to start from and return you the previous key.

Link to this function priority(value)
priority(integer()) :: Amnesia.Table.o()

Change the table loading priority.

Link to this function properties()
properties() :: Keyword.t()

Return properties of the table.

Link to this function read(key, lock \\ :read)
read(any(), :read | :write | :write!) :: t() | nil | no_return()

Read a record from the table with the given lock, see mnesia:read.

Unlike mnesia:read this returns either the record or nil.

Locks

  • :write sets a :write lock
  • :write! sets a :sticky_write lock
  • :read sets a :read lock
Link to this function read!(key)
read!(any()) :: t() | nil | no_return()

Read a record from the table, see mnesia:dirty_read.

Unlike mnesia:dirty_read this returns either the record or nil.

Link to this function read_at(key, position)
read_at(any(), integer() | atom()) :: [t()] | nil | no_return()

Read records from the table based on a secondary index given as position, see mnesia:index_read.

Link to this function read_at!(key, position)
read_at!(any(), integer() | atom()) :: [t()] | nil | no_return()

Read records from the table based on a secondary index given as position, see mnesia:dirty_index_read.

Link to this function select(spec)
select(any()) :: Amnesia.Table.Selection.t() | nil | no_return()

Select records in the table using a match_spec, see mnesia:select.

Link to this function select(lock_or_limit, spec)
select(integer() | :read | :write, any()) ::
  Amnesia.Table.Selection.t() |
  nil |
  no_return()

Select records in the given table using a match_spec passing a limit or a lock kind, see mnesia:select.

Link to this function select(lock_or_limit, limit_or_lock, spec)
select(integer() | :read | :write, integer() | :read | :write, integer()) ::
  Amnesia.Table.Selection.t() |
  nil |
  no_return()

Select records in the given table using a match_spec passing a limit and a lock kind, see mnesia:select.

Link to this function select!(spec)
select!(any()) :: Selection.t() | nil | no_return()

Select records in the table using a match_spec, see mnesia:dirty_select.

Link to this function set?()
set?() :: boolean()

Check if the table is a set.

Link to this function stream(lock \\ :read)
stream(:read | :write | :write!) :: Amnesia.Table.Stream.t()

Return an iterator to use with Enum functions.

Return an iterator to use with the Enum functions using dirty operations to retrieve information.

Link to this function type(self)
type(t()) :: :set | :ordered_set | :bag

Return the type of the table.

Link to this function wait(timeout \\ :infinity)
wait(integer() | :infinity) ::
  :ok |
  {:timeout, [atom()]} |
  {:error, atom()}

Wait for the table optionally with a timeout.

Link to this macro where(spec, options \\ []) (macro)

Select records in the table using an Exquisite query, see Exquisite.match/2 and mnesia:select.

Options

  • limit - sets the count of elements to select in every continuation
  • lock - sets the kind of lock to use
  • select - Exquisite selector spec
  • qualified - whether to set a name for the record or not
Link to this macro where!(spec, options \\ []) (macro)

Select records in the table using an Exquisite query, see Exquisite.match/2 and mnesia:dirty_select.

Options

  • select - Exquisite selector spec
  • qualified - whether to set a name for the record or not
Link to this function write(self, lock \\ :write)

Write the record to the table, see mnesia:write.

Missing fields tagged as autoincrement will be incremented with the counter if nil.

Link to this function write!(self)
write!(t()) :: t() | no_return()

Write the record to the table, see mnesia:dirty_write.

Missing fields tagged as autoincrement will be incremented with the counter if nil.