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

Ecto adapter for Amazon DynamoDB.

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.

Functions

autogenerate(atom)

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()

decode_item(map, repo, opts)

decode_item(item, types, repo, opts)

dumpers(type, datetime)

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.

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

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_started(config, type)

Ensure all applications necessary to run the adapter are started.

ex_aws_config(repo)

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

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.

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

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.

loaders(primitive, type)

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.

max_transaction_conflict_retries()

prepare(atom, query)

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

The returned result is given to execute/6.