Skip to content

Instantly share code, notes, and snippets.

@krakatoa
Created April 16, 2016 10:21
Show Gist options
  • Save krakatoa/61e423dbf01f247c6302c9fe9cb70512 to your computer and use it in GitHub Desktop.
Save krakatoa/61e423dbf01f247c6302c9fe9cb70512 to your computer and use it in GitHub Desktop.
mnesia-transform.ex
iex(15)> trans = fn(backup) ->
...(15)> IO.puts "backup: #{inspect backup}"
...(15)> backup
...(15)> end
#Function<6.50752066/1 in :erl_eval.expr/5>
iex(16)> :mnesia.transform_table(:endpoints, trans, [:idx, :host, :port, :transport])
backup: {:endpoint, 1, 'localhost', 5555, 'tcp'}
{:atomic, :ok}
iex(17)> :mnesia.transform_table(:endpoints, trans, [:idx, :host, :port, :transport])
backup: {:endpoint, 1, 'localhost', 5555, 'tcp'}
{:atomic, :ok}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment