Krug.MnesiaUtil (Krug v2.0.27) View Source
Utilitary module to handle some mnesia operations
Link to this section Summary
Functions
Provides cache functionality to clear cached results of all key value rows from a table "table_name". Return true or false.
Executes a "count" operation against a "table_name".
Provides encapsulated behaviour for delete stored key value using transaction for
Provides encapsulated behaviour for load the FIRST stored key value using transaction for
Provides encapsulated behaviour for load the stored key value using transaction for
Provides encapsulated behaviour for load the LAST stored key value using transaction for
Provides a way to check if mnesia already started. Return true or false.
Provides encapsulated behaviour for data storage using transaction for call
Executes a "select" operation against a "table_name" filtering by "map_pattern"
Provides encapsulated behaviour for data storage using transaction for call
Link to this section Functions
Provides cache functionality to clear cached results of all key value rows from a table "table_name". Return true or false.
Requires mnesia already be started.
Executes a "count" operation against a "table_name".
Requires mnesia already be started.
Provides encapsulated behaviour for delete stored key value using transaction for
:mnesia.delete(table_name,id_row,:write)
for an table "table_name". Return :ok.
Requires mnesia already be started.
Provides encapsulated behaviour for load the FIRST stored key value using transaction for
:mnesia.first(table_name)
for an table "table_name". Return the stored value or nil.
Requires mnesia already be started.
Provides encapsulated behaviour for load the stored key value using transaction for
:mnesia.read({table_name,id_row})
for an key "id_row" from an table "table_name". Return the stored value or nil.
Requires mnesia already be started.
Provides encapsulated behaviour for load the LAST stored key value using transaction for
:mnesia.last(table_name)
for an table "table_name". Return the stored value or nil.
Requires mnesia already be started.
Provides a way to check if mnesia already started. Return true or false.
Provides encapsulated behaviour for data storage using transaction for call
:mnesia.write({table_name,id_row,data_row})
Works in key value storage style, where "id_row" is the key, and "data_row" the value. Both values could be of any data type. "table_name" should be an atom. This is intended to be more key-value object storage (like Redis), where "data_row" could be anything from a simple string to a list, a map, a sql resultset, and many others.
Return true or false.
Requires mnesia already be started.
Executes a "select" operation against a "table_name" filtering by "map_pattern"
Requires mnesia already be started.
Provides encapsulated behaviour for data storage using transaction for call
data = [table_name | [id_row | data_row]]
data = data |> List.to_tuple() # result in {table_name,id_row,data_row[0] ... data_row[n]}
:mnesia.write(data)
Works in key value storage style, where "id_row" is the key, and "data_row" the value. Both values could be of any data type. "table_name" should be an atom. This run fine for normal mnesia usage way (storing objects as in database row).
Return true or false.
Requires mnesia already be started.