View Source Carve.Links (Carve v0.1.2)

Carve.Links provides functionality for retrieving and processing links between different entities.

This module is responsible for:

  • Fetching links for entities based on their IDs or data structures
  • Handling circular references and preventing infinite loops
  • Normalizing and preparing the final result set of links

It works in conjunction with the view modules created using Carve.View to generate a complete set of links for any given entity or set of entities.

Summary

Functions

Retrieves links for a given module and data or list of data.

Retrieves links for a given module and ID or list of IDs.

Prepares the final result set by flattening, removing nil values, and eliminating duplicates.

Functions

Prepares the final result set by flattening, removing nil values, and eliminating duplicates.

Parameters

  • result: A list of link maps

Returns

A cleaned and uniquified list of link maps.

Examples

iex> result = [[%{type: :team, id: "abc"}, nil], [%{type: :profile, id: "def"}], %{type: :team, id: "abc"}]
iex> Carve.Links.prepare_result(result)
[%{type: :team, id: "abc"}, %{type: :profile, id: "def"}]