View Source Backpex.Adapter behaviour (Backpex v0.8.1)

Specification of the datalayer adapter.

Work in progress

The Backpex.Adapter behaviour is currently under heavy development and will change drastically in future updates. Backpex started out as Ecto-only and this is still deeply embedded in the core. We are working on changing this. Do not rely on the current API to build new adapters, as the callbacks will still change significantly. This will be an iterative process over the next few releases.

Summary

Callbacks

Applies a change to a given item.

Gets the total count of the current live_resource. Possibly being constrained the item query and the search- and filter options.

Deletes multiple items.

Gets a database record with the given primary key value.

Gets a database record with the given primary key value.

Inserts given item.

Returns a list of items by given criteria.

Updates given item.

Updates given items.

Callbacks

Link to this callback

change(term, term, term, term, term, term)

View Source
@callback change(term(), term(), term(), term(), term(), term()) :: term()

Applies a change to a given item.

Link to this callback

count(term, term, term, term)

View Source
@callback count(term(), term(), term(), term()) :: term()

Gets the total count of the current live_resource. Possibly being constrained the item query and the search- and filter options.

@callback delete_all(list(), term()) :: {:ok, term()} | {:error, term()}

Deletes multiple items.

@callback get(term(), term(), term()) :: term()

Gets a database record with the given primary key value.

Should return nil if no result was found.

@callback get!(term(), term(), term()) :: term()

Gets a database record with the given primary key value.

Should raise an exception if no result was found.

@callback insert(term(), term()) :: term()

Inserts given item.

Link to this callback

list(term, term, term, term)

View Source
@callback list(term(), term(), term(), term()) :: term()

Returns a list of items by given criteria.

@callback update(term(), term()) :: term()

Updates given item.

Link to this callback

update_all(term, term, term)

View Source
@callback update_all(term(), term(), term()) :: term()

Updates given items.