Ash.DataLayer.Mnesia (ash v3.5.43)

View Source

An Mnesia backed Ash Datalayer.

In your application initialization, you will need to call Mnesia.create_schema([node()]).

Additionally, you will want to create your mnesia tables there.

This data layer is unoptimized, fetching all records from a table and filtering them in memory. For that reason, it is not recommended to use it with large amounts of data. It can be great for prototyping or light usage, though.

Summary

Functions

Bulk create records in the database.

Creates the table for each mnesia resource in a domain

Functions

bulk_create(resource, stream, options)

Bulk create records in the database.

This function is used to create multiple records in a single transaction.

If you are NOT setting the upsert? = true option, this will be optimized by creating a single transaction and bulk creating all of the entries. The way :mnesia.write works, will effectively do an upsert, but you cannot control which fields are updated and the only identity you are matching on is the primary key.

If you are using an upsert? it will be unoptimized and will load all records into memory before performing the upsert operation.

mnesia(body)

(macro)

start(domain, resources \\ [])

Creates the table for each mnesia resource in a domain