Ecto.Adapters.DynamoDB (ecto_adapters_dynamodb v3.1.2) View Source

Ecto adapter for Amazon DynamoDB.

Link to this section Summary

Functions

Called to autogenerate a value for id/embed_id/binary_id.

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.

Returns the loaders for a given type.

Commands invoked to prepare a query for all, update_all and delete_all.

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 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.

Link to this function

ecto_dynamo_log(level, message, attributes \\ %{}, opts \\ [])

View Source

Logs message to console and optionally to file. Log levels, colours and file path may be set in configuration (details in README.md).

Link to this function

ensure_all_started(config, type)

View Source

Ensure all applications necessary to run the adapter are started.

Link to this function

execute(map, query_meta, arg, params, opts)

View Source

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.

Link to this function

insert(repo_meta, schema_meta, fields, on_conflict, returning, opts)

View Source

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.

Link to this function

loaders(primitive, type)

View Source

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.Decoder, 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.