Dymo v1.0.2 Dymo.Tagger behaviour View Source
Defines the functions required for a tagger to be compabible with the Dymo.Taggable macro.
Link to this section Summary
Functions
Use this module to implements alternative Ecto.Tagger
A helper function that helps computing the field name to use in taggings queries.
A helper function that generates the join table name to be used for a given schema or model.
Callbacks
See Dymo.TaggerImpl.add_labels/{2,3}
.
See Dymo.TaggerImpl.add_labels/{2,3}
.
See Dymo.labeled_with.labels/4
.
See Dymo.labeled_with.labels/4
.
See Dymo.TaggerImpl.labels/{3,4}
.
See Dymo.TaggerImpl.labels/{3,4}
.
Link to this section Types
A join key is an atom.
A join table name is a string.
Link to this section Functions
Use this module to implements alternative Ecto.Tagger
By default, all functions are delegated to Ecto.Tagger
but can be overriden
join_key(module)
View Sourcejoin_key(Ecto.Schema.t() | module() | String.t()) :: atom()
A helper function that helps computing the field name to use in taggings queries.
Examples
iex> Tagger.join_key(Dymo.Post)
:post_id
iex> Tagger.join_key(%Dymo.Post{})
:post_id
iex> Tagger.join_key(Person)
:person_id
join_table(module)
View Sourcejoin_table(Ecto.Schema.t() | module() | String.t()) :: String.t()
A helper function that generates the join table name to be used for a given schema or model.
Examples
iex> Tagger.join_table(Dymo.Post)
"posts_tags"
iex> Tagger.join_table(%Dymo.Post{})
"posts_tags"
iex> Tagger.join_table(Person)
"people_tags"
singularize(target)
View Sourcesingularize(Ecto.Schema.t() | module() | String.t()) :: String.t()
Link to this section Callbacks
add_labels(arg1, arg2)
View Sourceadd_labels(Ecto.Schema.t(), Dymo.Tag.label_or_labels()) :: Ecto.Schema.t()
See Dymo.TaggerImpl.add_labels/{2,3}
.
add_labels(arg1, arg2, keyword)
View Sourceadd_labels(Ecto.Schema.t(), Dymo.Tag.label_or_labels(), keyword()) :: Ecto.Schema.t()
See Dymo.TaggerImpl.add_labels/{2,3}
.
all_labels(join_table, join_key)
View Sourceall_labels(join_table(), join_key()) :: Ecto.Query.t()
all_labels(join_table, join_key, keyword)
View Sourceall_labels(join_table(), join_key(), keyword()) :: Ecto.Query.t()
labeled_with(module, arg2, join_table, join_key)
View Sourcelabeled_with(module(), Dymo.Tag.label_or_labels(), join_table(), join_key()) :: Ecto.Query.t()
See Dymo.labeled_with.labels/4
.
labeled_with(module, arg2, join_table, join_key, keyword)
View Sourcelabeled_with( module(), Dymo.Tag.label_or_labels(), join_table(), join_key(), keyword() ) :: Ecto.Query.t()
See Dymo.labeled_with.labels/4
.
labels(arg1, join_table, join_key)
View Sourcelabels(Ecto.Schema.t(), join_table(), join_key()) :: Ecto.Query.t()
See Dymo.TaggerImpl.labels/{3,4}
.
labels(arg1, join_table, join_key, keyword)
View Sourcelabels(Ecto.Schema.t(), join_table(), join_key(), keyword()) :: Ecto.Query.t()
See Dymo.TaggerImpl.labels/{3,4}
.
remove_labels(arg1, arg2)
View Sourceremove_labels(Ecto.Schema.t(), Dymo.Tag.label_or_labels()) :: Ecto.Schema.t()
remove_labels(arg1, arg2, keyword)
View Sourceremove_labels(Ecto.Schema.t(), Dymo.Tag.label_or_labels(), keyword()) :: Ecto.Schema.t()
set_labels(arg1, arg2)
View Sourceset_labels(Ecto.Schema.t(), Dymo.Tag.label_or_labels()) :: Ecto.Schema.t()
set_labels(arg1, arg2, keyword)
View Sourceset_labels(Ecto.Schema.t(), Dymo.Tag.label_or_labels(), keyword()) :: Ecto.Schema.t()