Dymo v0.3.4 Dymo.Taggable View Source

Allows to easily make models taggable.

To use this module, you can simply leverage the use macro inside your model module:

use Dymo.Taggable

When doing so, the following functions will be added to the caller module:

  • all_labels/{0,1}
  • labeled_with/1

Doing so will require you to have a join table set up between the model and Dymo.Tag as well as a many_to_many relationship on your model.

For more information about their usage and typings, have a look at the Dymo.Tagger behaviour and the Dymo.TaggerImpl implementation.

Link to this section Summary

Functions

Add labels to the given namespace

Returns all labels associad with the given schema

Returned all objects of given type labeled with given labels

Returns all labels of the given namespace

Remove labels of given namespace

Set all labels of the given namespace, replacing existing ones

Use this macro in your Ecto schema to add tags field

Link to this section Types

Link to this section Functions

Link to this function add_labels(taggable, lbls) View Source
add_labels(t(), Dymo.Tag.label_or_labels()) :: Ecto.Schema.t()

Add labels to the given namespace

Link to this function add_labels(taggable, ns, lbls) View Source
add_labels(t(), Dymo.Tag.ns() | nil, Dymo.Tag.label_or_labels()) ::
  Ecto.Schema.t()
Link to this function all_labels(module, ns \\ nil) View Source
all_labels(module(), Dymo.Tag.ns() | nil) :: Ecto.Query.t()

Returns all labels associad with the given schema

Link to this function labeled_with(module, tags) View Source
labeled_with(module(), Dymo.Tag.label_or_labels()) :: Ecto.Query.t()

Returned all objects of given type labeled with given labels

Link to this function labels(taggable) View Source
labels(t()) :: [Dymo.Tag.label()]

Returns all labels of the given namespace

Link to this function labels(taggable, ns) View Source
labels(t(), Dymo.Tag.ns() | nil) :: [Dymo.Tag.label()]
Link to this function remove_labels(taggable, label_or_labels) View Source

Remove labels of given namespace

Link to this function remove_labels(taggable, ns, label_or_labels) View Source
remove_labels(t(), Dymo.Tag.ns() | nil, Dymo.Tag.label_or_labels()) ::
  Ecto.Schema.t()
Link to this function set_labels(taggable, lbls) View Source
set_labels(t(), Dymo.Tag.label_or_labels()) :: Ecto.Schema.t()

Set all labels of the given namespace, replacing existing ones.

Link to this function set_labels(taggable, ns, lbls) View Source
set_labels(t(), Dymo.Tag.ns() | nil, Dymo.Tag.label_or_labels()) ::
  Ecto.Schema.t()

Use this macro in your Ecto schema to add tags field