Reorderex v0.2.0-beta Reorderex.Ecto View Source

Reorderex.Ecto

Link to this section Summary

Functions

Moves the given entity to after an entity at after_id using Ecto repo.

Link to this section Functions

Link to this function

insert_after(entity, after_id, repo, opts \\ [])

View Source

Moves the given entity to after an entity at after_id using Ecto repo.

Example

photo
|> Reorderex.Ecto.insert_after(photo1.id, Repo)
|> Repo.update()

Options

  • :field - The field that store score of each row. Default to :score.
  • :query - In the case of ordering on shared table, query should narrow down Ecto model so a smaller set that contains the given entity and the entity at after_id.