cereal v1.3.2 Cereal.Utils View Source

Link to this section Summary

Functions

Takes a keyword list of comma separated strings keyed by serializer name and converts the strings into lists of atoms. Implicitly removes any binary string that cannot be safely converted to an atom.

Given a the name of a serializer, will return a string that represents the type of the entity being processed.

Given a set of included relations, will return a normalized list of child relations. Implicitly filters out any relation in the normalized tree that cannot be safely converted from a binary string to an atom.

Link to this section Functions

Link to this function

build_fields_list(fields)

View Source
build_fields_list([{atom(), String.t()}] | String.t()) :: [{atom(), [atom()]}]

Takes a keyword list of comma separated strings keyed by serializer name and converts the strings into lists of atoms. Implicitly removes any binary string that cannot be safely converted to an atom.

Example:

# Input
[user: "name,id,location", comment: "type"]

# Output
[user: [:name, :id, :location], comment: [:type]]

Given a the name of a serializer, will return a string that represents the type of the entity being processed.

Link to this function

normalize_includes(include)

View Source
normalize_includes(String.t()) :: Keyword.t()

Given a set of included relations, will return a normalized list of child relations. Implicitly filters out any relation in the normalized tree that cannot be safely converted from a binary string to an atom.