MishkaInstaller.Helper.MnesiaAssistant.Query (Mishka installer v0.1.8)

Copy Markdown View Source

Record-level Mnesia operations (read / write / delete / select / match).

Every function must run inside a MishkaInstaller.Helper.MnesiaAssistant.Transaction activity.

Summary

Functions

Deletes the record at key in table with the given lock. Delegates to :mnesia.delete/3.

Reads records via a secondary index attr matching key. Delegates to :mnesia.index_read/3.

Returns every record in a table matching pattern. Delegates to :mnesia.match_object/1.

Reads the records stored under key in table. Delegates to :mnesia.read/2.

Runs a match specification against table. Delegates to :mnesia.select/2.

Writes a full record tuple ({Table, field1, field2, ...}). Delegates to :mnesia.write/1.

Functions

delete(table, key, lock_type)

@spec delete(atom(), term(), :write | :sticky_write) :: :ok

Deletes the record at key in table with the given lock. Delegates to :mnesia.delete/3.

index_read(table, key, attr)

@spec index_read(atom(), term(), atom()) :: [tuple()]

Reads records via a secondary index attr matching key. Delegates to :mnesia.index_read/3.

match_object(pattern)

@spec match_object(tuple()) :: [tuple()]

Returns every record in a table matching pattern. Delegates to :mnesia.match_object/1.

read(table, key)

@spec read(atom(), term()) :: [tuple()]

Reads the records stored under key in table. Delegates to :mnesia.read/2.

select(table, spec)

@spec select(atom(), list()) :: list()

Runs a match specification against table. Delegates to :mnesia.select/2.

write(record)

@spec write(tuple()) :: :ok

Writes a full record tuple ({Table, field1, field2, ...}). Delegates to :mnesia.write/1.