Noizu.Entity.Store.Amnesia.EntityProtocol protocol (NoizuLabs Entities v0.2.1)
Protocol used to save/load entities from store. Leverage Entity.FieldProtocol to pack/unpack individual fields.
Summary
Types
Context Record
An Entity That Implements the Entity Protocol
Options Keyword List
An Amnesia Record
Persistence Settings
All the types that implement this protocol.
Field Handler
Functions
Transform record to entity
Transform to expected entity record format.
Delete record entity
Transform record to entity
as_entity helper convert record to entity - fetch
as_entity helper convert record to entity
Save entity to store.
Types
@type context() :: any()
Context Record
@type entity() :: any()
An Entity That Implements the Entity Protocol
@type options() :: nil | list()
Options Keyword List
@type record() :: any()
An Amnesia Record
@type settings() :: Noizu.Entity.Meta.Persistence.persistence_settings()
Persistence Settings
@type t() :: term()
All the types that implement this protocol.
@type type() :: any()
Field Handler
Functions
@spec as_entity(entity(), record(), settings(), context(), options()) :: {:ok, entity()} | {:error, any()}
Transform record to entity
Transform to expected entity record format.
@spec delete_record(entity(), settings(), context(), options()) :: {:ok, entity()} | {:error, any()}
Delete record entity
@spec fetch_as_entity(entity(), settings(), context(), options()) :: {:ok, entity()} | {:error, any()}
Transform record to entity
as_entity helper convert record to entity - fetch
@spec merge_from_record(entity(), record(), settings(), context(), options()) :: {:ok, entity()} | {:error, any()}
as_entity helper convert record to entity
@spec persist(entity(), type(), settings(), context(), options()) :: {:ok, entity()} | {:error, any()}
Save entity to store.