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
:indices
specifies a list of additional indices to use instead of the first attribute.:type
specifies the type of the table, it can be:set
,:ordered_set
and:bag
, the default is:set
:mode
specifies the access mode, it can be:both
and:read!
, the default is:both
:majority
specifies the majority of the table, the default isfalse
:priority
specifies the load priority of the table:local
specifies 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