Packages
ecto_adapters_dynamodb
0.3.0
3.6.1
3.6.0
3.5.0
3.4.1
3.4.0
3.3.7
3.3.6
3.3.5
3.3.4
3.3.3
3.3.2
3.3.1
3.3.0
3.2.0
3.1.3
3.1.2
3.1.1
3.1.0
3.0.3
3.0.2
3.0.1
3.0.0
2.0.4
2.0.3
2.0.2
2.0.1
2.0.0
2.0.0-beta.1
2.0.0-beta.0
2.0.0-alpha.4
2.0.0-alpha.3
2.0.0-alpha.2
2.0.0-alpha.1
2.0.0-alpha.0
1.3.0
1.2.1
1.2.0
1.1.3
0.5.1
0.5.0
0.4.6
0.4.5
0.4.4
0.4.3
0.4.2
0.4.1
0.4.0
0.3.0
0.2.3
0.2.2
0.2.1
0.1.2
0.1.1
A DynamoDB adapter for Ecto supporting basic queries. See https://github.com/circles-learning-labs/ecto_adapters_dynamodb for detailed instructions.
Current section
Files
Jump to
Current section
Files
lib/ecto_adapters_dynamodb/query_info.ex
defmodule Ecto.Adapters.DynamoDB.QueryInfo do
@moduledoc """
An Elixir agent to optionally record DynamoDB query information (like LastEvaluatedKey) that's not part of expected Ecto return values.
"""
def start_link, do: Agent.start_link(fn -> %{} end, name: __MODULE__)
@doc """
Provides a random 32 character, base 64 encoded string.
"""
def get_key, do: :crypto.strong_rand_bytes(32) |> Base.url_encode64
def put(key, val), do: Agent.update(__MODULE__, fn map -> Map.put(map, key, val) end)
@doc """
Returns the value (query info) in the QueryInfo agent associated with the provided key.
"""
def get(key), do: Agent.get_and_update(__MODULE__, fn map -> {map[key], Map.delete(map, key)} end)
@doc """
Returns the complete current map recorded by the agent.
"""
def get_map, do: Agent.get(__MODULE__, fn map -> map end)
end