Dymo v0.1.3 Dymo.Tag View Source
This module provides functionality dedicated to handling tag data.
It essentially aims at maintaining singleton labels in a tags
table
and exposes helper functions to ease their creation.
Link to this section Summary
Link to this section Types
Defines simple tags identified by a unique label.
Link to this section Functions
Makes a changeset suited to manipulate the Dymo.Tag
model.
This function gets an existing tag using its label. If the tag doesn’t exit, it is atomically created. It could be described as a “singleton” helper.
Examples
iex> %{id: id1a} = Tag.find_or_create!("novel")
iex> [%{id: id2a}, %{id: id3a}] = Tag.find_or_create!(["article", "book"])
iex> [%{id: id1b}, %{id: id2b}, %{id: id3b}] = Tag.find_or_create!(["novel", "article", "book"])
iex> {id1a, id2a, id3a} == {id1b, id2b, id3b}
true