Ecto.Adapters.DynamoDB (ecto_adapters_dynamodb v3.6.0)
View SourceEcto 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
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.
The adapter relies on ExAws encoding functionality to format types for DynamoDB wire protocol. However, some Ecto types need preprocessing before ExAws can handle them. This module provides custom dumpers for :utc_datetime, :naive_datetime (to add ISO8601 formatting), and :decimal types (to convert Decimal structs to strings that ExAws can encode).
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.
Returns the loaders for a given type.
The adapter builds on ExAws' decoding functionality (see ExAws.Dynamo.Decoder) to convert DynamoDB wire format to basic Elixir types. However, Ecto 3.13+ requires additional type conversion from these basic types to proper Ecto types. This module provides custom loaders for :utc_datetime, :naive_datetime, and :decimal types to handle this conversion (e.g., converting string "104.50" to Decimal struct, ISO8601 strings to DateTime structs).
Commands invoked to prepare a query for all, update_all and delete_all.
The returned result is given to execute/6.