EctoOrderable (ecto_orderable v0.1.0)

Documentation for EctoOrderable.

Summary

Functions

Returns the ordered index of the first child in the ordered series.

Returns the ordered index of the last child in the ordered series.

Moves an Order item in a set.

Returns the next ordered index, should be used for appending children.

Returns the sibling immediately after an item in the set, nil if there is none.

Returns the sibling immediately before an item in the set, nil if there is none.

Functions

first_order(order_struct)

Returns the ordered index of the first child in the ordered series.

last_order(order_struct)

Returns the ordered index of the last child in the ordered series.

move(order_struct, opts)

Moves an Order item in a set.

Options

* `:between` - Moves to between the items specified by a tuple `{before_id, after_id}`.
  Either may be `nil`, in the case that there is no previous or next item. If both are `nil`,
  it is assumed that the item being moved is the only item in the set, and its order will
  not be changed.
* `:direction` - Moves one place in the set, either `:up` or `:down`.

next_order(order_struct)

Returns the next ordered index, should be used for appending children.

sibling_after(order_struct)

Returns the sibling immediately after an item in the set, nil if there is none.

sibling_before(order_struct)

Returns the sibling immediately before an item in the set, nil if there is none.