ecto_mnesia v0.1.0 Ecto.Mnesia.Adapter

Ecto.Adapter for mnesia Erlang term database.

It supports compound mnesia indexes (aka secondary indexes) in database setup. The implementation relies directly on mnesia application. Supports partial Ecto.Query to MatchSpec conversion for mnesia:select (and, join). MatchSpec converion utilities could be found in Ecto.Mnesia.Query.

Configuration Sample

defmodule Sample.Model do
  require Record
    def keys, do: [id_seq:       [:thing],
                   topics:       [:whom,:who,:what],
                   config:       [:key]]

    def meta, do: [id_seq:       [:thing, :id],
                   config:       [:key, :value],
                   topics:       Model.Topics.__schema__(:fields)]
end

where Model.Topics is Ecto.Schema object.

usage in config.exs

config :ecto, :mnesia_metainfo, Sample.Model
config :ecto, :mnesia_backend,  :ram_copies

Summary

Functions

Retrieve all records from the given table using mnesia:all_keys

The name of the application is :ecto

Callback implementation for Ecto.Adapter.autogenerate/1

Delete Record of Ecto Schema Instace from mnesia database

Print directory of mnesia tables on local node

Callback implementation for Ecto.Adapter.dumpers/2

Perform mnesia:select on prepared query and convert the results to Ecto Schema

Insert Ecto Schema Instance to mnesia database

List of tables with compound (aka secondary indexes) keys: {table,keys}

Callback implementation for Ecto.Adapter.loaders/2

Default list of tables available for storage up: {table,fields}

Sequence autogeneration is implemented as mnesia:update_counter

Convert Ecto Qeury to Erlang MatchSpec, include caching

Mnesia starting during Adapter boot

Stopping Mnesia Adapter

Update Record of Ecto Schema Instance in mnesia database

Functions

all(table)

Retrieve all records from the given table using mnesia:all_keys.

application()

The name of the application is :ecto.

autogenerate(x)

Callback implementation for Ecto.Adapter.autogenerate/1.

child_spec(repo, opts)

Callback implementation for Ecto.Adapter.child_spec/2.

count(table)
delete(repo, map, , )

Delete Record of Ecto Schema Instace from mnesia database.

dir()

Print directory of mnesia tables on local node.

dumpers(primitive, type)

Callback implementation for Ecto.Adapter.dumpers/2.

execute(repo, map, query, params, preprocess, options)

Perform mnesia:select on prepared query and convert the results to Ecto Schema.

insert(repo, map, params, autogen, opts)

Insert Ecto Schema Instance to mnesia database.

insert_all(, , , , , )

Callback implementation for Ecto.Adapter.insert_all/6.

keys()

List of tables with compound (aka secondary indexes) keys: {table,keys}.

loaders(primitive, type)

Callback implementation for Ecto.Adapter.loaders/2.

many(fun)
meta()

Default list of tables available for storage up: {table,fields}.

next_id(record, inc)

Sequence autogeneration is implemented as mnesia:update_counter.

prepare(atom, arg)

Convert Ecto Qeury to Erlang MatchSpec, include caching.

start_link(, , , , )

Mnesia starting during Adapter boot.

stop(, )

Stopping Mnesia Adapter.

storage_down(x)
update(repo, meta, params, filter, autogen, opts)

Update Record of Ecto Schema Instance in mnesia database.