View Source Backpex.Resource (Backpex v0.1.1)
Generic context module for Backpex resources.
Summary
Functions
Gets the total count of the current live_resource. Possibly being constrained the item query and the search- and filter options.
Deletes the given record from the database. Additionally broadcasts the corresponding event, when PubSub is enabled.
Deletes the given records from the database. Additionally broadcasts the corresponding event, when PubSub is enabled.
Gets a database record with the given fields by the given id, possibly being enhanced by the given item_query.
Tries to insert the given changes as a new item for the current resource. Additionally broadcasts the corresponding event, when PubSub is enabled.
Returns a list of items by given criteria.
Returns the main database query for selecting a list of items by given criteria.
Gets name by schema. This is the last part of the module name as a lowercase atom.
Tries to update the current item with the given changes. Additionally broadcasts the corresponding event, when PubSub is enabled.
Tries to update many items with the given changes. Additionally broadcasts the corresponding event, when PubSub is enabled.
Functions
count(assigns, item_query, fields, search_options, filter_options)
View SourceGets the total count of the current live_resource. Possibly being constrained the item query and the search- and filter options.
Deletes the given record from the database. Additionally broadcasts the corresponding event, when PubSub is enabled.
Deletes the given records from the database. Additionally broadcasts the corresponding event, when PubSub is enabled.
Gets a database record with the given fields by the given id, possibly being enhanced by the given item_query.
Tries to insert the given changes as a new item for the current resource. Additionally broadcasts the corresponding event, when PubSub is enabled.
Returns a list of items by given criteria.
Example criteria:
[ order: %{by: :item, direction: :asc}, pagination: %{page: 1, size: 5}, search: {"hello", [:title, :description]} ]
Returns the main database query for selecting a list of items by given criteria.
Gets name by schema. This is the last part of the module name as a lowercase atom.
Examples
iex> Backpex.Resource.name_by_schema(Backpex.Resource)
:resource
Tries to update the current item with the given changes. Additionally broadcasts the corresponding event, when PubSub is enabled.
Tries to update many items with the given changes. Additionally broadcasts the corresponding event, when PubSub is enabled.