ecto_adapters_dynamodb v0.2.3 Ecto.Adapters.DynamoDB View Source
Ecto adapter for Amazon DynamoDB
Currently for a fairly limited subset of Ecto, enough for basic operations.
Link to this section Summary
Functions
Called to autogenerate a value for id/embed_id/binary_id
Returns the childspec that starts the adapter process
Deletes a single struct with the given filters
Returns the dumpers for a given type
Logs message to console and optionally to file. Log levels, colours and file path may be set in configuration (details in README.md)
Ensure all applications necessary to run the adapter are started
Executes a previously prepared query
Inserts a single new struct in the data store
Inserts multiple entries into the data store
Returns the loaders for a given type
Commands invoked to prepare a query for all
, update_all
and delete_all
Updates a single struct with the given filters
Link to this section Functions
Called to autogenerate a value for id/embed_id/binary_id.
Returns the autogenerated value, or nil if it must be autogenerated inside the storage or raise if not supported.
For the Ecto type, :id
, the adapter autogenerates a 128-bit integer
For the Ecto type, :embed_id
, the adapter autogenerates a string, using Ecto.UUID.generate()
For the Ecto type, :binary_id
, the adapter autogenerates a string, using Ecto.UUID.generate()
Returns the childspec that starts the adapter process.
Deletes a single struct with the given filters.
While filters
can be any record column, it is expected that
at least the primary key (or any other key that uniquely
identifies an existing record) be given as a filter. Therefore,
in case there is no record matching the given filters,
{:error, :stale}
is returned.
Callback implementation for Ecto.Adapter.delete/4
.
Returns the dumpers for a given type.
We rely on ExAws encoding functionality during insertion and update to properly format types for DynamoDB. Please see ExAws ExAws.Dynamo.update_item
and ExAws.Dynamo.put_item
for specifics. Currently, we only modify :utc_datetime and :naive_datetime, appending the UTC offset, “Z”, to the datetime string before passing to ExAws.
Logs message to console and optionally to file. Log levels, colours and file path may be set in configuration (details in README.md).
Ensure all applications necessary to run the adapter are started.
Executes a previously prepared query.
It must return a tuple containing the number of entries and
the result set as a list of lists. The result set may also be
nil
if a particular operation does not support them.
The meta
field is a map containing some of the fields found
in the Ecto.Query
struct.
It receives a process function that should be invoked for each
selected field in the query result in order to convert them to the
expected Ecto type. The process
function will be nil if no
result set is expected from the query.
Inserts a single new struct in the data store.
Autogenerate
The primary key will be automatically included in returning
if the
field has type :id
or :binary_id
and no value was set by the
developer or none was autogenerated by the adapter.
Inserts multiple entries into the data store.
Callback implementation for Ecto.Adapter.insert_all/7
.
Returns the loaders for a given type.
Rather than use the Ecto adapter loaders callback, the adapter builds on ExAws’ decoding functionality, please see ExAws’s ExAws.Dynamo.decode_item
and the private function, custom_decode
, in this module, which at this time only loads :utc_datetime and :naive_datetime.
Commands invoked to prepare a query for all
, update_all
and delete_all
.
The returned result is given to execute/6
.
Updates a single struct with the given filters.
While filters
can be any record column, it is expected that
at least the primary key (or any other key that uniquely
identifies an existing record) be given as a filter. Therefore,
in case there is no record matching the given filters,
{:error, :stale}
is returned.
Callback implementation for Ecto.Adapter.update/6
.