Packages
TestcontainerEx is an Elixir library for integration testing with containerized services. Start, stop, and monitor Docker, Podman, Minikube, Colima, or Apple Container containers with a unified API. Supports custom containers.
Current section
Files
Jump to
Current section
Files
lib/util/hash.ex
defmodule TestcontainerEx.Util.Hash do
@moduledoc false
alias TestcontainerEx.Util.ListFromDeepStruct
def struct_to_hash(struct) when is_struct(struct) do
struct
|> ListFromDeepStruct.from_deep_struct()
|> Kernel.then(&inspect(&1))
|> (&:crypto.hash(:sha256, &1)).()
|> Base.encode16(case: :lower)
end
end