expected v0.1.1 Expected.MnesiaStore View Source
Stores login data in a Mnesia table.
To use this store, configure :expected
accordingly and set the table name in
the application configuration:
config :expected,
store: :mnesia,
table: :logins,
...
This table is not created by the store. You can use helpers to create it (see
Expected
) or create it yourself. In the latter case, you must ensure
that:
- the table is a
:bag
, - it stores
Expected.MnesiaStore.LoginRecord
, i.e. therecord_name
is set to:login
and the attributes are theExpected.Login
keys, :serial
and:last_login
must be indexed.
For instance:
:mnesia.start()
:mnesia.create_table(
:logins,
type: :bag,
record_name: :login,
attributes: Expected.Login.keys(),
index: [:serial, :last_login],
disc_copies: [node()]
)
For Mnesia to work properly, you need to add it to your extra applications:
def application do
[
mod: {MyApp.Application, []},
extra_applications: [:logger, :mnesia]
]
end