Tags_Multi_Tenant v0.4.1 Tags_Multi_Tenant View Source

Documentation for Tags_Multi_Tenant. Tags_Multi_Tenant allows you to manage tags associated to your records.

Please read README.md to get more info about how to use that package.

Link to this section Summary

Functions

Get a persisted struct and inserts a new tag associated to this struct for a specific context

Get a persisted struct and removes the tag association for a specific context

It searchs the associated tags for a specific context

Given a tag, module and context (‘tag’ by default), will find all the module resources associated to the given tag

The same than tagged_with/3 but returns the query instead of db results

Link to this section Types

Link to this type tag_list() View Source
tag_list() :: list
Link to this type taggable() View Source
taggable() :: module | struct

Link to this section Functions

Link to this function add(struct, tags, context \\ "tags") View Source
add(struct, tags, context) :: struct

Get a persisted struct and inserts a new tag associated to this struct for a specific context.

You can pass a tag or a list of tags.

In case the tag would be duplicated nothing will happen.

It returns the struct with a new entry for the given context.

Link to this function remove(struct, tag, context \\ "tags") View Source
remove(struct, tag, context) :: struct

Get a persisted struct and removes the tag association for a specific context.

In case the association doesn’t exist nothing will happen.

In the same way that add/3 it returns a struct

Link to this function tag_list(taggable, context \\ "tags") View Source
tag_list(taggable, context) :: tag_list

It searchs the associated tags for a specific context.

You can pass as first argument an struct or a module (phoenix model)

  • With a struct: it returns the list of tags associated to that struct and context.
  • With a module: it returns all the tags associated to one module and context.
Link to this function tagged_with(tags, model, context \\ "tags") View Source
tagged_with(tags, module, context) :: list

Given a tag, module and context (‘tag’ by default), will find all the module resources associated to the given tag.

You can pass a simple tag or a list of tags.

Link to this function tagged_with_query(query, tags, context \\ "tags") View Source

The same than tagged_with/3 but returns the query instead of db results.

The purpose of this function is allow you to include it in your filter flow or perform actions like paginate the results.