amnesia v0.2.8 Amnesia.Database
Link to this section Summary
Functions
Define a table in the database with the given name, attributes and options.
Link to this section Functions
Define a table in the database with the given name, attributes and options.
If only a name is given, it will forward declare a table.
The created table will actually be a record, so you can define functions on it like you would normally do for a record, various helper methods are added by default.
Options
:indicesspecifies a list of additional indices to use instead of the first attribute.:typespecifies the type of the table, it can be:set,:ordered_setand:bag, the default is:set:modespecifies the access mode, it can be:bothand:read!, the default is:both:majorityspecifies the majority of the table, the default isfalse:priorityspecifies the load priority of the table:localspecifies if the table is local, default isfalse
Example
use Amnesia
defdatabase Foo do
deftable Bar, [:id, :a], type: :bag
deftable Baz, [:id, :a, :b] do
def foo(self)
42
end
end
end