Dymo v1.0.3 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

Types

A join key is an atom.

A join table name is a string.

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.

Link to this section Types

Link to this type

join_key()

View Source
join_key() :: atom()

A join key is an atom.

Link to this type

join_table()

View Source
join_table() :: String.t()

A join table name is a string.

Link to this section Functions

Link to this macro

__using__(opts)

View Source (macro)

Use this module to implements alternative Ecto.Tagger

By default, all functions are delegated to Ecto.Tagger but can be overriden

Link to this function

join_key(module)

View Source
join_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
Link to this function

join_table(module)

View Source
join_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"
Link to this function

singularize(target)

View Source
singularize(Ecto.Schema.t() | module() | String.t()) :: String.t()

Link to this section Callbacks

See Dymo.TaggerImpl.add_labels/{2,3}.

See Dymo.TaggerImpl.add_labels/{2,3}.

Link to this callback

all_labels(join_table, join_key)

View Source
all_labels(join_table(), join_key()) :: Ecto.Query.t()

See Dymo.TaggerImpl.all_labels/3.

Link to this callback

all_labels(join_table, join_key, keyword)

View Source
all_labels(join_table(), join_key(), keyword()) :: Ecto.Query.t()

See Dymo.TaggerImpl.all_labels/3.

Link to this callback

labeled_with(module, arg2, join_table, join_key)

View Source

See Dymo.labeled_with.labels/4.

Link to this callback

labeled_with(module, arg2, join_table, join_key, keyword)

View Source

See Dymo.labeled_with.labels/4.

Link to this callback

labels(arg1, join_table, join_key)

View Source

See Dymo.TaggerImpl.labels/{3,4}.

Link to this callback

labels(arg1, join_table, join_key, keyword)

View Source

See Dymo.TaggerImpl.labels/{3,4}.

See Dymo.TaggerImpl.remove_labels/3.

Link to this callback

remove_labels(arg1, arg2, keyword)

View Source

See Dymo.TaggerImpl.remove_labels/3.

See Dymo.TaggerImpl.set_labels/3.

See Dymo.TaggerImpl.set_labels/3.