ecto_nested_changeset icon indicating copy to clipboard operation
ecto_nested_changeset copied to clipboard

add functions for changing order

Open woylie opened this issue 3 years ago • 2 comments

  • [ ] swap([:pets, 3], 5)
  • [ ] move_up([:pets, 3])
  • [ ] move_down([:pets, 3])
  • [ ] move_to([:pets, 3], 5])

woylie avatar Feb 04 '22 06:02 woylie

how do we swap one pet's toys with another pet's toys at specific positions

[%Pet{id: 1, toys: [a, b]}, %Pet{id: 2, toys: [c, d]}]

jacmacmod avatar Feb 04 '22 07:02 jacmacmod

Probably swap([:owners, 2, :pets, 3], [:owners, 4, :pets, 1]).

woylie avatar Feb 04 '22 07:02 woylie