EctoRanked (ecto_ranked v0.6.0)

This module provides support for automatic ranking of your Ecto models.

Summary

Functions

Updates the given changeset with the appropriate ranking, and updates/ranks the other items in the list as necessary.

Functions

Link to this function

set_rank(changeset, opts \\ [])

@spec set_rank(Ecto.Changeset.t(), Keyword.t()) :: Ecto.Changeset.t()

Updates the given changeset with the appropriate ranking, and updates/ranks the other items in the list as necessary.

Options

  • :rank - the field to store the actual ranking in. Defaults to :rank
  • :position - the field to use for positional changes. Defaults to :position
  • :scope - the field(s) to scope all rankings to. Defaults to nil (no scoping).
  • :prefix - the prefix to run all queries on (e.g. the schema path in Postgres). Defaults to nil (no prefix).