Skip to content

Instantly share code, notes, and snippets.

@rugyoga
Created September 4, 2022 21:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rugyoga/4ef2e004bf106581b0fc6fae8e475bc7 to your computer and use it in GitHub Desktop.
Save rugyoga/4ef2e004bf106581b0fc6fae8e475bc7 to your computer and use it in GitHub Desktop.
Take delta of two structs
@spec delta_struct(path(), struct(), struct()) :: delta_spec()
def delta_struct(path, %a_s{} = a, %b_s{} = b) when a_s != b_s, do: delta_simple(path, a, b)
def delta_struct(path, a, b), do: delta_map(path, Map.from_struct(a), Map.from_struct(b))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment