Bonfire.Social.FeedFilters.StringList (Bonfire v0.9.12-social-beta.71)
View SourceSummary
Functions
Casts a value to a list of strings.
Dumps a list of strings for database storage.
Callback implementation for Ecto.Type.embed_as/1
.
Callback implementation for Ecto.Type.equal?/2
.
Loads a list of strings from database storage.
Callback implementation for Ecto.Type.type/0
.
Functions
Casts a value to a list of strings.
Examples
iex> Bonfire.Social.FeedFilters.StringList.cast(["a", "b"])
{:ok, ["a", "b"]}
iex> Bonfire.Social.FeedFilters.StringList.cast("single_item")
{:ok, ["single_item"]}
iex> Bonfire.Social.FeedFilters.StringList.cast([%{id: "123"}, %{id: "456"}])
{:ok, ["123", "456"]}
iex> Bonfire.Social.FeedFilters.StringList.cast(%{id: "789"})
{:ok, ["789"]}
iex> Bonfire.Social.FeedFilters.StringList.cast(["a", "a", "b"])
{:ok, ["a", "b"]}
iex> Bonfire.Social.FeedFilters.StringList.cast([1, 2, 3])
:error
iex> Bonfire.Social.FeedFilters.StringList.cast(123)
:error
Dumps a list of strings for database storage.
Examples
iex> Bonfire.Social.FeedFilters.StringList.dump(["item1", "item2"])
{:ok, ["item1", "item2"]}
iex> Bonfire.Social.FeedFilters.StringList.dump("not_a_list")
:error
Callback implementation for Ecto.Type.embed_as/1
.
Callback implementation for Ecto.Type.equal?/2
.
Loads a list of strings from database storage.
Examples
iex> Bonfire.Social.FeedFilters.StringList.load(["item1", "item2"])
{:ok, ["item1", "item2"]}
iex> Bonfire.Social.FeedFilters.StringList.load("not_a_list")
:error
Callback implementation for Ecto.Type.type/0
.