ecto_mnesia v0.3.0 Ecto.Adapters.Mnesia
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_meta_schema, Sample.Model
config :ecto, :mnesia_backend, :ram_copies
Summary
Functions
Automatically generate next ID
Returns the childspec that starts the adapter process.
This method is called from Ecto.Repo.Supervisor.init/2
Deletes a record from a Mnesia database
Callback implementation for Ecto.Adapter.dumpers/2
Ensure all applications necessary to run the adapter are started
Callback implementation for Ecto.Adapter.in_transaction?/1
Insert Ecto Schema struct to Mnesia database
Callback implementation for Ecto.Adapter.insert_all/7
Return directory that stores Mnesia tables on local node
This function tells Ecto that we don’t support DDL transactions
Callback implementation for Ecto.Adapter.transaction/3
Updates record stored in a Mnesia database
Functions
Returns the childspec that starts the adapter process.
This method is called from Ecto.Repo.Supervisor.init/2
.
Callback implementation for Ecto.Adapter.dumpers/2
.
Callback implementation for Ecto.Adapter.in_transaction?/1
.
Insert Ecto Schema struct to Mnesia database.
TODO:
- Process
opts
. - Process
on_conflict
- Process
returning
Callback implementation for Ecto.Adapter.insert_all/7
.
Callback implementation for Ecto.Adapter.transaction/3
.