DataProvider.Data (DataProvider v1.2.1) View Source

The data module of DataProvider which result of DataProvider processing

In this struct:

  • items - it is a list of result user request

Link to this section Summary

Types

t()

DataProvider data value, contains

Functions

Creates DataProvider.Data struct by received find_result and DataProvider.

Link to this section Types

Specs

t() :: %DataProvider.Data{items: list(), total_count: integer()}

DataProvider data value, contains:

  • items - List of found data for exactly this DataProvider

  • total_count - integer value with count of items in items

Link to this section Functions

Link to this function

create(data_provider, find_result)

View Source

Specs

create(DataProvider.t(), Ecto.Query.t() | list()) :: t()

Creates DataProvider.Data struct by received find_result and DataProvider.

Args:

  • data_provider - data provider, which been use by user for getting find_result

  • find_result - value, which been returned by find/1 function of user's DataProvider implementation

Function will execute behaviour depending on what value was in find_result

  1. If received find_result is a Ecto.Query then it will be processed by DataProvider.QueryModifier. The reveived query will be executed and result of execution gonna be put into items of new DataProvider.Data struct.

  2. If received find_result is a list(), then it will be processed by DataProvider.ListModifier. The received data will be put into items of new DataProvider.Data struct.